Skip to:
Content

BuddyPress.org

Ticket #5266: 5266.01.patch

File 5266.01.patch, 25.2 KB (added by r-a-y, 12 years ago)
  • bp-activity/bp-activity-notifications.php

    if ( !defined( 'ABSPATH' ) ) exit; 
    1515 *
    1616 * @since BuddyPress (1.2)
    1717 *
    18  * @uses bp_core_add_notification()
     18 * @uses bp_notifications_add_notification()
    1919 * @uses bp_get_user_meta()
    2020 * @uses bp_core_get_user_displayname()
    2121 * @uses bp_activity_get_permalink()
    function bp_activity_at_message_notification( $activity_id, $receiver_user_id ) 
    5555        $content = '';
    5656
    5757        // Add the BP notification
    58         bp_core_add_notification( $activity_id, $receiver_user_id, 'activity', 'new_at_mention', $activity->user_id );
     58        if ( bp_is_active( 'notifications' ) ) {
     59                bp_notifications_add_notification( $activity_id, $receiver_user_id, 'activity', 'new_at_mention', $activity->user_id );
     60        }
    5961
    6062        // Now email the user with the contents of the message (if they have enabled email notifications)
    6163        if ( 'no' != bp_get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) {
  • bp-activity/bp-activity-screens.php

    function bp_activity_screen_mentions() { 
    133133 *
    134134 * @since BuddyPress (1.5)
    135135 *
    136  * @uses bp_core_mark_all_notifications_by_type()
     136 * @uses bp_notifications_mark_all_notifications_by_type()
    137137 */
    138138function bp_activity_remove_screen_notifications() {
    139         bp_core_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->activity->id, 'new_at_mention' );
     139        if ( bp_is_active( 'notifications' ) ) {
     140                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->activity->id, 'new_at_mention' );
     141        }
    140142}
    141143add_action( 'bp_activity_screen_my_activity',               'bp_activity_remove_screen_notifications' );
    142144add_action( 'bp_activity_screen_single_activity_permalink', 'bp_activity_remove_screen_notifications' );
  • bp-friends/bp-friends-cache.php

    function friends_clear_friend_object_cache( $friendship_id ) { 
    3232 * Clear friend-related notifications when ?new=1.
    3333 */
    3434function friends_clear_friend_notifications() {
    35         if ( isset( $_GET['new'] ) ) {
    36                 bp_core_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->friends->id, 'friendship_accepted' );
     35        if ( isset( $_GET['new'] ) && bp_is_active( 'notifications' ) ) {
     36                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->friends->id, 'friendship_accepted' );
    3737        }
    3838}
    3939add_action( 'bp_activity_screen_my_activity', 'friends_clear_friend_notifications' );
  • bp-friends/bp-friends-functions.php

    function friends_add_friend( $initiator_userid, $friend_userid, $force_accept = 
    4949
    5050                if ( !$force_accept ) {
    5151                        // Add the on screen notification
    52                         bp_core_add_notification( $friendship->initiator_user_id, $friendship->friend_user_id, $bp->friends->id, 'friendship_request' );
     52                        if ( bp_is_active( 'notifications' ) ) {
     53                                bp_notifications_add_notification( $friendship->initiator_user_id, $friendship->friend_user_id, $bp->friends->id, 'friendship_request' );
     54                        }
    5355
    5456                        // Send the email notification
    5557                        friends_notification_new_request( $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
    function friends_accept_friendship( $friendship_id ) { 
    118120        if ( !$friendship->is_confirmed && BP_Friends_Friendship::accept( $friendship_id ) ) {
    119121                friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id );
    120122
    121                 // Remove the friend request notice
    122                 bp_core_mark_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' );
     123                if ( bp_is_active( 'notifications' ) ) {
     124                        // Remove the friend request notice
     125                        bp_notifications_mark_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' );
    123126
    124                 // Add a friend accepted notice for the initiating user
    125                 bp_core_add_notification( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_accepted' );
     127                        // Add a friend accepted notice for the initiating user
     128                        bp_notifications_add_notification( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_accepted' );
     129                }
    126130
    127131                $initiator_link = bp_core_get_userlink( $friendship->initiator_user_id );
    128132                $friend_link = bp_core_get_userlink( $friendship->friend_user_id );
    function friends_reject_friendship( $friendship_id ) { 
    171175        if ( !$friendship->is_confirmed && BP_Friends_Friendship::reject( $friendship_id ) ) {
    172176
    173177                // Remove the friend request notice
    174                 bp_core_mark_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' );
     178                if ( bp_is_active( 'notifications' ) ) {
     179                        bp_notifications_mark_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' );
     180                }
    175181
    176182                do_action_ref_array( 'friends_friendship_rejected', array( $friendship_id, &$friendship ) );
    177183                return true;
    function friends_withdraw_friendship( $initiator_userid, $friend_userid ) { 
    196202
    197203        if ( !$friendship->is_confirmed && BP_Friends_Friendship::withdraw( $friendship_id ) ) {
    198204                // Remove the friend request notice
    199                 bp_core_delete_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' );
     205                if ( bp_is_active( 'notifications' ) ) {
     206                        bp_notifications_delete_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' );
     207                }
    200208
    201209                do_action_ref_array( 'friends_friendship_whithdrawn', array( $friendship_id, &$friendship ) );
    202210                return true;
    function friends_remove_data( $user_id ) { 
    576584        bp_delete_user_meta( $user_id, 'total_friend_count' );
    577585
    578586        // Remove friendship requests FROM user
    579         bp_core_delete_notifications_from_user( $user_id, $bp->friends->id, 'friendship_request' );
     587        if ( bp_is_active( 'notifications' ) ) {
     588                bp_notifications_delete_notifications_from_user( $user_id, $bp->friends->id, 'friendship_request' );
     589        }
    580590
    581591        do_action( 'friends_remove_data', $user_id );
    582592}
  • bp-friends/bp-friends-screens.php

    if ( !defined( 'ABSPATH' ) ) exit; 
    2020function friends_screen_my_friends() {
    2121
    2222        // Delete any friendship acceptance notifications for the user when viewing a profile
    23         bp_core_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->friends->id, 'friendship_accepted' );
     23        if ( bp_is_active( 'notifications' ) ) {
     24                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->friends->id, 'friendship_accepted' );
     25        }
    2426
    2527        do_action( 'friends_screen_my_friends' );
    2628
    function friends_screen_requests() { 
    6769
    6870        do_action( 'friends_screen_requests' );
    6971
    70         if ( isset( $_GET['new'] ) ) {
    71                 bp_core_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->friends->id, 'friendship_request' );
     72        if ( isset( $_GET['new'] ) && bp_is_active( 'notifications' ) ) {
     73                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->friends->id, 'friendship_request' );
    7274        }
    7375
    7476        bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) );
  • bp-groups/bp-groups-functions.php

    function groups_delete_group( $group_id ) { 
    217217        groups_delete_all_group_invites( $group_id );
    218218
    219219        // Remove all notifications for any user belonging to this group
    220         bp_core_delete_all_notifications_by_type( $group_id, $bp->groups->id );
     220        if ( bp_is_active( 'notifications' ) ) {
     221                bp_notifications_delete_all_notifications_by_type( $group_id, $bp->groups->id );
     222        }
    221223
    222224        do_action( 'groups_delete_group', $group_id);
    223225
    function groups_accept_invite( $user_id, $group_id ) { 
    718720        // Modify group meta
    719721        groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
    720722
    721         bp_core_mark_notifications_by_item_id( $user_id, $group_id, buddypress()->groups->id, 'group_invite' );
     723        if ( bp_is_active( 'notifications' ) ) {
     724                bp_notifications_mark_notifications_by_item_id( $user_id, $group_id, buddypress()->groups->id, 'group_invite' );
     725        }
    722726
    723727        do_action( 'groups_accept_invite', $user_id, $group_id );
    724728        return true;
    function groups_delete_invite( $user_id, $group_id ) { 
    737741
    738742        $delete = BP_Groups_Member::delete_invite( $user_id, $group_id );
    739743
    740         if ( !empty( $delete ) ) {
    741                 bp_core_mark_notifications_by_item_id( $user_id, $group_id, buddypress()->groups->id, 'group_invite' );
     744        if ( !empty( $delete ) && bp_is_active( 'notifications' ) ) {
     745                bp_notifications_mark_notifications_by_item_id( $user_id, $group_id, buddypress()->groups->id, 'group_invite' );
    742746        }
    743747
    744748        return $delete;
    function groups_remove_data_for_user( $user_id ) { 
    10781082
    10791083        BP_Groups_Member::delete_all_for_user( $user_id );
    10801084
    1081         bp_core_delete_notifications_from_user( $user_id, $bp->groups->id, 'new_membership_request' );
     1085        if ( bp_is_active( 'notifications' ) ) {
     1086                bp_notifications_delete_notifications_from_user( $user_id, $bp->groups->id, 'new_membership_request' );
     1087        }
    10821088
    10831089        do_action( 'groups_remove_data_for_user', $user_id );
    10841090}
  • bp-groups/bp-groups-notifications.php

    To view the group: %2$s 
    5656
    5757function groups_notification_new_membership_request( $requesting_user_id, $admin_id, $group_id, $membership_id ) {
    5858
    59         bp_core_add_notification( $requesting_user_id, $admin_id, 'groups', 'new_membership_request', $group_id );
     59        if ( bp_is_active( 'notifications' ) ) {
     60                bp_notifications_add_notification( $requesting_user_id, $admin_id, 'groups', 'new_membership_request', $group_id );
     61        }
    6062
    6163        if ( 'no' == bp_get_user_meta( $admin_id, 'notification_groups_membership_request', true ) )
    6264                return false;
    To view %4$s\'s profile: %5$s 
    105107function groups_notification_membership_request_completed( $requesting_user_id, $group_id, $accepted = true ) {
    106108
    107109        // Post a screen notification first.
    108         if ( $accepted )
    109                 bp_core_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_accepted' );
    110         else
    111                 bp_core_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_rejected' );
     110        if ( bp_is_active( 'notifications' ) ) {
     111                if ( $accepted ) {
     112                        bp_notifications_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_accepted' );
     113                } else {
     114                        bp_notifications_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_rejected' );
     115                }
     116        }
    112117
    113118        if ( 'no' == bp_get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) )
    114119                return false;
    function groups_notification_promoted_member( $user_id, $group_id ) { 
    171176        }
    172177
    173178        // Post a screen notification first.
    174         bp_core_add_notification( $group_id, $user_id, 'groups', $type );
     179        if ( bp_is_active( 'notifications' ) ) {
     180                bp_notifications_add_notification( $group_id, $user_id, 'groups', $type );
     181        }
    175182
    176183        if ( 'no' == bp_get_user_meta( $user_id, 'notification_groups_admin_promotion', true ) )
    177184                return false;
    function groups_notification_group_invites( &$group, &$member, $inviter_user_id 
    222229                $invited_user_id = $member->user_id;
    223230
    224231                // Post a screen notification first.
    225                 bp_core_add_notification( $group->id, $invited_user_id, 'groups', 'group_invite' );
     232                if ( bp_is_active( 'notifications' ) ) {
     233                        bp_notifications_add_notification( $group->id, $invited_user_id, 'groups', 'group_invite' );
     234                }
    226235
    227236                if ( 'no' == bp_get_user_meta( $invited_user_id, 'notification_groups_invite', true ) )
    228237                        return false;
  • bp-groups/bp-groups-screens.php

    function groups_screen_my_groups() { 
    3030        $bp = buddypress();
    3131
    3232        // Delete group request notifications for the user
    33         if ( isset( $_GET['n'] ) ) {
    34                 bp_core_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_accepted' );
    35                 bp_core_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_rejected' );
    36                 bp_core_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_mod'      );
    37                 bp_core_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_admin'    );
     33        if ( isset( $_GET['n'] ) && bp_is_active( 'notifications' ) ) {
     34                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_accepted' );
     35                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_rejected' );
     36                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_mod'      );
     37                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_admin'    );
    3838        }
    3939
    4040        do_action( 'groups_screen_my_groups' );
    function groups_screen_group_invites() { 
    9494        }
    9595
    9696        // Remove notifications
    97         bp_core_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->groups->id, 'group_invite' );
     97        if ( bp_is_active( 'notifications' ) ) {
     98                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->groups->id, 'group_invite' );
     99        }
    98100
    99101        do_action( 'groups_screen_group_invites', $group_id );
    100102
    function groups_screen_group_home() { 
    108110
    109111        $bp = buddypress();
    110112
    111         if ( isset( $_GET['n'] ) ) {
    112                 bp_core_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_accepted' );
    113                 bp_core_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_rejected' );
    114                 bp_core_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_mod'      );
    115                 bp_core_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_admin'    );
     113        if ( isset( $_GET['n'] ) && bp_is_active( 'notifications' ) ) {
     114                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_accepted' );
     115                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_rejected' );
     116                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_mod'      );
     117                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_admin'    );
    116118        }
    117119
    118120        do_action( 'groups_screen_group_home' );
    function groups_screen_group_admin_requests() { 
    813815                return false;
    814816
    815817        // Remove any screen notifications
    816         bp_core_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'new_membership_request' );
     818        if ( bp_is_active( 'notifications' ) ) {
     819                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'new_membership_request' );
     820        }
    817821
    818822        $request_action = (string)bp_action_variable( 1 );
    819823        $membership_id  = (int)bp_action_variable( 2 );
  • bp-members/bp-members-notifications.php

    if ( !defined( 'ABSPATH' ) ) exit; 
    1616/**
    1717 * Add a notification for a specific user, from a specific component
    1818 *
     19 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     20 *  bp_notifications_add_notification() instead.
     21 *
    1922 * @since BuddyPress (1.0)
    2023 * @param string $item_id
    2124 * @param int $user_id
    function bp_core_add_notification( $item_id, $user_id, $component_name, $compone 
    5356/**
    5457 * Delete a specific notification by its ID
    5558 *
     59 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     60 *  bp_notifications_delete_notification() instead.
     61 *
    5662 * @since BuddyPress (1.0)
    5763 * @param int $id
    5864 * @return boolean True on success, false on fail
    function bp_core_delete_notification( $id ) { 
    7076/**
    7177 * Get a specific notification by its ID
    7278 *
     79 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     80 *  bp_notifications_get_notification() instead.
     81 *
    7382 * @since BuddyPress (1.0)
    7483 * @param int $id
    7584 * @return BP_Core_Notification
    function bp_core_get_notification( $id ) { 
    8796/**
    8897 * Get notifications for a specific user
    8998 *
     99 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     100 *  bp_notifications_get_notifications_for_user() instead.
     101 *
    90102 * @since BuddyPress (1.0)
    91103 * @global BuddyPress $bp
    92104 * @param int $user_id
    function bp_core_get_notifications_for_user( $user_id, $format = 'simple' ) { 
    113125 * Used when clearing out notifications for a specific component when the user
    114126 * has visited that component.
    115127 *
     128 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     129 *  bp_notifications_delete_notifications_by_type() instead.
     130 *
    116131 * @since BuddyPress (1.0)
    117132 * @param int $user_id
    118133 * @param string $component_name
    function bp_core_delete_notifications_by_type( $user_id, $component_name, $compo 
    135150 * Used when clearing out notifications for a specific component when the user
    136151 * has visited that component.
    137152 *
     153 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     154 *  bp_notifications_delete_notifications_by_item_id() instead.
     155 *
    138156 * @since BuddyPress (1.0)
    139157 * @param int $user_id
    140158 * @param string $component_name
    function bp_core_delete_notifications_by_item_id( $user_id, $item_id, $component 
    154172/**
    155173 * Delete all notifications for by type
    156174 *
     175 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     176 *  bp_notifications_delete_all_notifications_by_type() instead.
     177 *
    157178 * @since BuddyPress (1.0)
    158179 * @param int $user_id
    159180 * @param string $component_name
    function bp_core_delete_all_notifications_by_type( $item_id, $component_name, $c 
    175196 *
    176197 * Used when clearing out all notifications for a user, whene deleted or spammed
    177198 *
     199 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     200 *  bp_notifications_delete_notifications_from_user() instead.
     201 *
    178202 * @since BuddyPress (1.0)
    179203 * @param int $user_id
    180204 * @param string $component_name
    function bp_core_delete_notifications_from_user( $user_id, $component_name, $com 
    191215        return bp_notifications_delete_notifications_from_user( $user_id, $component_name, $component_action );
    192216}
    193217
    194 /** Mark **********************************************************************/
    195 
    196 /**
    197  * Delete notifications for a user by type
    198  *
    199  * Used when clearing out notifications for a specific component when the user
    200  * has visited that component.
    201  *
    202  * @since BuddyPress (1.9.0)
    203  * @param int $user_id
    204  * @param string $component_name
    205  * @param string $component_action
    206  * @param int $is_new
    207  * @return boolean True on success, false on fail
    208  */
    209 function bp_core_mark_notifications_by_type( $user_id, $component_name, $component_action, $is_new = false ) {
    210 
    211         // Bail if notifications is not active
    212         if ( ! bp_is_active( 'notifications' ) ) {
    213                 return false;
    214         }
    215 
    216         return bp_notifications_mark_notifications_by_type( $user_id, $component_name, $component_action, $is_new );
    217 }
    218 
    219 /**
    220  * Delete notifications for an item ID
    221  *
    222  * Used when clearing out notifications for a specific component when the user
    223  * has visited that component.
    224  *
    225  * @since BuddyPress (1.9.0)
    226  * @param int $user_id
    227  * @param string $component_name
    228  * @param string $component_action
    229  * @param int $is_new
    230  * @return boolean True on success, false on fail
    231  */
    232 function bp_core_mark_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false, $is_new = false ) {
    233 
    234         // Bail if notifications is not active
    235         if ( ! bp_is_active( 'notifications' ) ) {
    236                 return false;
    237         }
    238 
    239         return bp_notifications_mark_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id, $is_new );
    240 }
    241 
    242 /**
    243  * Mark all notifications read/unread for by type
    244  *
    245  * Used when clearing out notifications for an entire component
    246  *
    247  * @since BuddyPress (1.9.0)
    248  * @param int $user_id
    249  * @param string $component_name
    250  * @param string $component_action
    251  * @return boolean True on success, false on fail
    252  */
    253 function bp_core_mark_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false, $is_new = false ) {
    254 
    255         // Bail if notifications is not active
    256         if ( ! bp_is_active( 'notifications' ) ) {
    257                 return false;
    258         }
    259 
    260         bp_notifications_mark_all_notifications_by_type( $item_id, $component_name, $component_action, $secondary_item_id, $is_new );
    261 }
    262 
    263 /**
    264  * Mark all notifications read/unread from a user
    265  *
    266  * @since BuddyPress (1.9.0)
    267  * @param int $user_id
    268  * @param string $component_name
    269  * @param string $component_action
    270  * @return boolean True on success, false on fail
    271  */
    272 function bp_core_mark_notifications_from_user( $user_id, $component_name, $component_action, $is_new = false ) {
    273 
    274         // Bail if notifications is not active
    275         if ( ! bp_is_active( 'notifications' ) ) {
    276                 return false;
    277         }
    278 
    279         return bp_notifications_mark_notifications_from_user( $user_id, $component_name, $component_action, $is_new );
    280 }
    281 
    282218/** Helpers *******************************************************************/
    283219
    284220/**
    function bp_core_mark_notifications_from_user( $user_id, $component_name, $compo 
    286222 *
    287223 * Used before deleting a notification for a user
    288224 *
     225 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     226 *  bp_notifications_check_notification_access() instead.
     227 *
    289228 * @since BuddyPress (1.0)
    290229 * @param int $user_id
    291230 * @param int $notification_id
  • bp-messages/bp-messages-functions.php

    function messages_new_message( $args = '' ) { 
    116116        if ( $message->send() ) {
    117117
    118118                // Send screen notifications to the recipients
    119                 foreach ( (array) $message->recipients as $recipient ) {
    120                         bp_core_add_notification( $message->id, $recipient->user_id, 'messages', 'new_message', $message->sender_id );
     119                if ( bp_is_active( 'notifications' ) ) {
     120                        foreach ( (array) $message->recipients as $recipient ) {
     121                                bp_notifications_add_notification( $message->id, $recipient->user_id, 'messages', 'new_message', $message->sender_id );
     122                        }
    121123                }
    122124
    123125                // Send email notifications to the recipients
  • bp-messages/bp-messages-template.php

    function bp_has_message_threads( $args = '' ) { 
    184184        if ( bp_is_current_action( 'notices' ) && !bp_current_user_can( 'bp_moderate' ) ) {
    185185                wp_redirect( bp_displayed_user_id() );
    186186        } else {
    187                 if ( bp_is_current_action( 'inbox' ) ) {
    188                         bp_core_mark_notifications_by_type( bp_loggedin_user_id(), $bp->messages->id, 'new_message' );
     187                if ( bp_is_current_action( 'inbox' ) && bp_is_active( 'notifications' ) ) {
     188                        bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $bp->messages->id, 'new_message' );
    189189                }
    190190
    191191                if ( bp_is_current_action( 'sentbox' ) ) {
  • bp-notifications/bp-notifications-adminbar.php

    function bp_notifications_toolbar_menu() { 
    2424                return false;
    2525        }
    2626
    27         $notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id(), 'object' );
     27        $notifications = bp_notifications_get_notifications_for_user( bp_loggedin_user_id(), 'object' );
    2828        $count         = ! empty( $notifications ) ? count( $notifications ) : 0;
    2929        $alert_class   = (int) $count > 0 ? 'pending-count alert' : 'count no-alert';
    3030        $menu_title    = '<span id="ab-pending-notifications" class="' . $alert_class . '">' . $count . '</span>';
  • bp-notifications/bp-notifications-buddybar.php

    function bp_notifications_buddybar_menu() { 
    2727        echo '<li id="bp-adminbar-notifications-menu"><a href="' . bp_loggedin_user_domain() . '">';
    2828        _e( 'Notifications', 'buddypress' );
    2929
    30         if ( $notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id() ) ) : ?>
     30        if ( $notifications = bp_notifications_get_notifications_for_user( bp_loggedin_user_id() ) ) : ?>
    3131                <span><?php echo count( $notifications ) ?></span>
    3232        <?php
    3333        endif;