Skip to:
Content

BuddyPress.org

Changeset 4620


Ignore:
Timestamp:
07/06/2011 07:10:08 PM (13 years ago)
Author:
boonebgorges
Message:

Provides initial support for Notifications menu in WP Admin Bar. Refactors group and friendship notifications to return values compatible with the WP Admin Bar constructor. Modifies bp_core_get_notifications_for_user() in order to provide WP Admin Bar support in addition to BuddyBar backpat. References #3294

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/css/admin-bar.css

    r4615 r4620  
    7373}
    7474
    75 #wpadminbar .quicklinks li#wp-admin-bar-user-admin-with-avatar > a img {
     75#wpadminbar .quicklinks li#wp-admin-bar-user-admin-with-avatar > a img,
     76#wpadminbar .quicklinks li#wp-admin-bar-group-admin-with-avatar > a img {
    7677    width: 16px;
    7778    height: 16px;
     
    8586}
    8687
    87 #wpadminbar .quicklinks li#wp-admin-bar-user-admin-with-avatar ul {
    88     left: 0;
     88#wpadminbar .quicklinks li#wp-admin-bar-user-admin-with-avatar ul,
     89#wpadminbar .quicklinks li#wp-admin-bar-group-admin-with-avatar ul {
     90    left: 30px;
    8991}
    9092
    91 #wpadminbar .quicklinks li#wp-admin-bar-user-admin-with-avatar ul ul {
     93#wpadminbar .quicklinks li#wp-admin-bar-user-admin-with-avatar ul ul,
     94#wpadminbar .quicklinks li#wp-admin-bar-group-admin-with-avatar ul ul {
    9295    left: 0;
    9396}
     
    119122    left: 0;
    120123}
     124
     125#wpadminbar .quicklinks li#wp-admin-bar-notifications #ab-pending-notifications {
     126    background: #eee;
     127    color: #333;
     128    text-shadow: none;
     129    display: inline;
     130    padding: 2px 5px;
     131    font-size: 10px;
     132    font-weight: bold;
     133    -moz-border-radius: 10px;
     134    -khtml-border-radius: 10px;
     135    -webkit-border-radius: 10px;
     136    border-radius: 10px;
     137}
  • trunk/bp-friends/bp-friends-activity.php

    r4551 r4620  
    5252add_action( 'bp_register_activity_actions', 'friends_register_activity_actions' );
    5353
    54 function friends_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) {
     54function friends_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
    5555    global $bp;
    5656
    5757    switch ( $action ) {
    5858        case 'friendship_accepted':
    59         $user_fullname = bp_core_get_user_displayname( $item_id );
    60             if ( (int)$total_items > 1 )
    61                 return apply_filters( 'bp_friends_multiple_friendship_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/my-friends/newest">' . sprintf( __('%d friends accepted your friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', (int)$total_items );
    62             else
    63                 return apply_filters( 'bp_friends_single_friendship_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/my-friends/newest">' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
    64 
     59            $link = bp_loggedin_user_domain() . $bp->friends->slug . '/my-friends/newest';
     60           
     61            // Set up the string and the filter
     62            if ( (int)$total_items > 1 ) {
     63                $text = sprintf( __( '%d friends accepted your friendship requests', 'buddypress' ), (int)$total_items );
     64                $filter = 'bp_friends_multiple_friendship_accepted_notification';
     65            } else {
     66                $text = sprintf( __( '%s accepted your friendship request', 'buddypress' ),  bp_core_get_user_displayname( $item_id ) );
     67                $filter = 'bp_friends_single_friendship_accepted_notification';
     68            }
     69           
    6570            break;
    6671
    6772        case 'friendship_request':
     73            $link = bp_loggedin_user_domain() . $bp->friends->slug . '/requests';
     74           
     75            // Set up the string and the filter
    6876            if ( (int)$total_items > 1 ) {
    69                 return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests/?new" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
     77                $text = sprintf( __( 'You have %d pending friendship requests', 'buddypress' ), (int)$total_items );
     78                $filter = 'bp_friends_multiple_friendship_request_notification';
    7079            } else {
    71                 $user_fullname = bp_core_get_user_displayname( $item_id );
    72                 $user_url = bp_core_get_user_domain( $item_id );
    73                 return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests/?new" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
     80                $text = sprintf( __( 'You have a friendship request from %s', 'buddypress' ),  bp_core_get_user_displayname( $item_id ) );
     81                $filter = 'bp_friends_single_friendship_request_notification';
    7482            }
     83       
    7584            break;
    7685    }
     86       
     87    // Return either an HTML link or an array, depending on the requested format
     88    if ( 'string' == $format ) {
     89        $return = apply_filters( $filter, '<a href="' . $link . '">' . $text . '</a>', (int)$total_items );
     90    } else {
     91        $return = apply_filters( $filter, array(
     92            'link' => $link,
     93            'text' => $text
     94        ), (int)$total_items );
     95    }
    7796
    78     do_action( 'friends_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
     97    do_action( 'friends_format_notifications', $action, $item_id, $secondary_item_id, $total_items, $return );
    7998
    80     return false;
     99    return $return;
    81100}
    82101
  • trunk/bp-groups/bp-groups-activity.php

    r4384 r4620  
    7474add_action( 'groups_new_forum_topic_post', 'groups_update_last_activity' );
    7575
    76 function groups_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) {
     76function groups_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
    7777    global $bp;
    7878
     
    8383
    8484            $group = new BP_Groups_Group( $group_id );
    85 
    86             $group_link = bp_get_group_permalink( $group );
    87 
    88             if ( (int)$total_items > 1 ) {
    89                 return apply_filters( 'bp_groups_multiple_new_membership_requests_notification', '<a href="' . $group_link . '/admin/membership-requests/?n=1" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int)$total_items, $group->name ) . '</a>', $group_link, $total_items, $group->name );
     85            $group_link = bp_get_group_permalink( $group );
     86
     87            // Set up the string and the filter
     88            // Because different values are passed to the filters, we'll return the
     89            // values inline
     90            if ( (int)$total_items > 1 ) {
     91                $text = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int)$total_items, $group->name );
     92                $filter = 'bp_groups_multiple_new_membership_requests_notification';
     93                $notification_link = $group_link . 'admin/membership-requests/?n=1';
     94               
     95                if ( 'string' == $format ) {
     96                    return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . $text . '</a>', $group_link, $total_items, $group->name, $text, $notification_link );
     97                } else {
     98                    return apply_filters( $filter, array(
     99                        'link' => $notification_link,
     100                        'text' => $text
     101                    ), $group_link, $total_items, $group->name, $text, $notification_link );
     102                }
    90103            } else {
    91104                $user_fullname = bp_core_get_user_displayname( $requesting_user_id );
    92                 return apply_filters( 'bp_groups_single_new_membership_request_notification', '<a href="' . $group_link . 'admin/membership-requests/?n=1" title="' . sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname ) . '">' . sprintf( __( '%1$s requests membership for the group "%2$s"', 'buddypress' ), $user_fullname, $group->name ) . '</a>', $group_link, $user_fullname, $group->name );
    93             }
     105                $text = sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname );
     106                $filter = 'bp_groups_single_new_membership_request_notification';
     107                $notification_link = $group_link . '?n=1';
     108               
     109                if ( 'string' == $format ) {
     110                    return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname ) . '">' . $text . '</a>', $group_link, $user_fullname, $group->name, $text, $notification_link );
     111                } else {
     112                    return apply_filters( $filter, array(
     113                        'link' => $notification_link,
     114                        'text' => $text
     115                    ), $group_link, $user_fullname, $group->name, $text, $notification_link );
     116                }
     117            }
     118           
    94119            break;
    95120
     
    100125            $group_link = bp_get_group_permalink( $group );
    101126
    102             if ( (int)$total_items > 1 )
    103                 return apply_filters( 'bp_groups_multiple_membership_request_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/?n=1" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __( '%d accepted group membership requests', 'buddypress' ), (int)$total_items, $group->name ) . '</a>', $total_items, $group->name );
    104             else
    105                 return apply_filters( 'bp_groups_single_membership_request_accepted_notification', '<a href="' . $group_link . '?n=1">' . sprintf( __( 'Membership for group "%s" accepted', 'buddypress' ), $group->name ) . '</a>', $group_link, $group->name );
     127            if ( (int)$total_items > 1 ) {
     128                $text = sprintf( __( '%d accepted group membership requests', 'buddypress' ), (int)$total_items, $group->name );
     129                $filter = 'bp_groups_multiple_membership_request_accepted_notification';               
     130                $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/?n=1';
     131               
     132                if ( 'string' == $format ) {
     133                    return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $group->name, $text, $notification_link );
     134                } else {
     135                    return apply_filters( $filter, array(
     136                        'link' => $notification_link,
     137                        'text' => $text
     138                    ), $total_items, $group->name, $text, $notification_link );
     139                }
     140            } else {
     141                $text = sprintf( __( 'Membership for group "%s" accepted', 'buddypress' ), $group->name );
     142                $filter = 'bp_groups_single_membership_request_accepted_notification';
     143                $notification_link = $group_link . '?n=1';
     144               
     145                if ( 'string' == $format ) {
     146                    return apply_filters( $filter, '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
     147                } else {
     148                    return apply_filters( $filter, array(
     149                        'link' => $notification_link,
     150                        'text' => $text
     151                    ), $group_link, $group->name, $text, $notification_link );
     152                }
     153            }
    106154
    107155            break;
     
    112160            $group = new BP_Groups_Group( $group_id );
    113161            $group_link = bp_get_group_permalink( $group );
    114 
    115             if ( (int)$total_items > 1 )
    116                 return apply_filters( 'bp_groups_multiple_membership_request_rejected_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/?n=1" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __( '%d rejected group membership requests', 'buddypress' ), (int)$total_items, $group->name ) . '</a>', $total_items, $group->name );
    117             else
    118                 return apply_filters( 'bp_groups_single_membership_request_rejected_notification', '<a href="' . $group_link . '?n=1">' . sprintf( __( 'Membership for group "%s" rejected', 'buddypress' ), $group->name ) . '</a>', $group_link, $group->name );
     162           
     163            if ( (int)$total_items > 1 ) {
     164                $text = sprintf( __( '%d rejected group membership requests', 'buddypress' ), (int)$total_items, $group->name );
     165                $filter = 'bp_groups_multiple_membership_request_rejected_notification';
     166                $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/?n=1';
     167               
     168                if ( 'string' == $format ) {
     169                    return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $group->name );
     170                } else {
     171                    return apply_filters( $filter, array(
     172                        'link' => $notification_link,
     173                        'text' => $text
     174                    ), $total_items, $group->name, $text, $notification_link );
     175                }
     176            } else {
     177                $text = sprintf( __( 'Membership for group "%s" rejected', 'buddypress' ), $group->name );
     178                $filter = 'bp_groups_single_membership_request_rejected_notification';
     179                $notification_link = $group_link . '?n=1';
     180               
     181                if ( 'string' == $format ) {
     182                    return apply_filters( $filter, '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
     183                } else {
     184                    return apply_filters( $filter, array(
     185                        'link' => $notification_link,
     186                        'text' => $text
     187                    ), $group_link, $group->name, $text, $notification_link );
     188                }
     189            }
    119190
    120191            break;
     
    126197            $group_link = bp_get_group_permalink( $group );
    127198
    128             if ( (int)$total_items > 1 )
    129                 return apply_filters( 'bp_groups_multiple_member_promoted_to_admin_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/?n=1" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
    130             else
    131                 return apply_filters( 'bp_groups_single_member_promoted_to_admin_notification', '<a href="' . $group_link . '?n=1">' . sprintf( __( 'You were promoted to an admin in the group %s', 'buddypress' ), $group->name ) . '</a>', $group_link, $group->name );
     199            if ( (int)$total_items > 1 ) {
     200                $text = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int)$total_items );
     201                $filter = 'bp_groups_multiple_member_promoted_to_admin_notification';
     202                $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '?n=1';
     203               
     204                if ( 'string' == $format ) {
     205                    return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
     206                } else {
     207                    return apply_filters( $filter, array(
     208                        'link' => $notification_link,
     209                        'text' => $text
     210                    ), $total_items, $text, $notification_link );
     211                }
     212            } else {
     213                $text = sprintf( __( 'You were promoted to an admin in the group "%s"', 'buddypress' ), $group->name );
     214                $filter = 'bp_groups_single_member_promoted_to_admin_notification';
     215                $notification_link = $group_link . '?n=1';
     216               
     217                if ( 'string' == $format ) {
     218                    return apply_filters( $filter, '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
     219                } else {
     220                    return apply_filters( $filter, array(
     221                        'link' => $notification_link,
     222                        'text' => $text
     223                    ), $group_link, $group->name, $text, $notification_link );
     224                }
     225            }
    132226
    133227            break;
     
    139233            $group_link = bp_get_group_permalink( $group );
    140234
    141             if ( (int)$total_items > 1 )
    142                 return apply_filters( 'bp_groups_multiple_member_promoted_to_mod_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/?n=1" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
    143             else
    144                 return apply_filters( 'bp_groups_single_member_promoted_to_mod_notification', '<a href="' . $group_link . '?n=1">' . sprintf( __( 'You were promoted to a mod in the group %s', 'buddypress' ), $group->name ) . '</a>', $group_link, $group->name );
     235            if ( (int)$total_items > 1 ) {
     236                $text = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int)$total_items );
     237                $filter = 'bp_groups_multiple_member_promoted_to_mod_notification';
     238                $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '?n=1';
     239               
     240                if ( 'string' == $format ) {
     241                    return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
     242                } else {
     243                    return apply_filters( $filter, array(
     244                        'link' => $notification_link,
     245                        'text' => $text
     246                    ), $total_items, $text, $notification_link );
     247                }
     248            } else {
     249                $text = sprintf( __( 'You were promoted to a mod in the group "%s"', 'buddypress' ), $group->name );
     250                $filter = 'bp_groups_single_member_promoted_to_mod_notification';
     251                $notification_link = $group_link . '?n=1';
     252               
     253                if ( 'string' == $format ) {
     254                    return apply_filters( $filter, '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
     255                } else {
     256                    return apply_filters( $filter, array(
     257                        'link' => $notification_link,
     258                        'text' => $text
     259                    ), $group_link, $group->name, $text, $notification_link );
     260                }
     261            }
    145262
    146263            break;
     
    148265        case 'group_invite':
    149266            $group_id = $item_id;
    150             $group = new BP_Groups_Group( $group_id );
    151 
    152             if ( (int)$total_items > 1 )
    153                 return apply_filters( 'bp_groups_multiple_group_invite_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/invites/?n=1" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __( 'You have %d new group invitations', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
    154             else
    155                 return apply_filters( 'bp_groups_single_group_invite_notification', '<a href="' . $bp->loggedin_user->domain . $bp->groups->slug . '/invites/?n=1" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __( 'You have an invitation to the group: %s', 'buddypress' ), $group->name ) . '</a>', $group->name );
     267            $group = new BP_Groups_Group( $group_id ); 
     268            $group_link = bp_get_group_permalink( $group );
     269           
     270            $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/?n=1';
     271
     272            if ( (int)$total_items > 1 ) {
     273                $text = sprintf( __( 'You have %d new group invitations', 'buddypress' ), (int)$total_items );
     274                $filter = 'bp_groups_multiple_group_invite_notification';
     275               
     276                if ( 'string' == $format ) {
     277                    return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Group Invites', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
     278                } else {
     279                    return apply_filters( $filter, array(
     280                        'link' => $notification_link,
     281                        'text' => $text
     282                    ), $total_items, $text, $notification_link );
     283                }
     284            } else {
     285                $text = sprintf( __( 'You have an invitation to the group: %s', 'buddypress' ), $group->name );
     286                $filter = 'bp_groups_single_group_invite_notification';
     287               
     288                if ( 'string' == $format ) {
     289                    return apply_filters( $filter, '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
     290                } else {
     291                    return apply_filters( $filter, array(
     292                        'link' => $notification_link,
     293                        'text' => $text
     294                    ), $group_link, $group->name, $text, $notification_link );
     295                }
     296            }
    156297
    157298            break;
  • trunk/bp-groups/bp-groups-loader.php

    r4586 r4620  
    4848            'buddybar',
    4949            'adminbar',
    50             'functions'
     50            'functions',
     51            'notifications'
    5152        );
    5253        parent::_includes( $includes );
  • trunk/bp-members/bp-members-adminbar.php

    r4586 r4620  
    7373 * @since 1.3
    7474 */
    75 function bp_members_user_admin_menu() {
     75function bp_members_admin_bar_user_admin_menu() {
    7676    global $bp, $wp_admin_bar;
    7777
     
    146146    ) );
    147147}
    148 add_action( 'bp_setup_admin_bar', 'bp_members_user_admin_menu', 99 );
     148add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_user_admin_menu', 99 );
     149
     150/**
     151 * Build the "Notifications" dropdown
     152 *
     153 * @package Buddypress
     154 * @since 1.3
     155 */
     156function bp_members_admin_bar_notifications_menu() {
     157    global $bp, $wp_admin_bar;
     158
     159    if ( !is_user_logged_in() )
     160        return false;
     161       
     162    if ( $notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id(), 'object' ) ) {
     163        $menu_title = sprintf( __( 'Notifications <span id="ab-pending-notifications" class="pending-count">%s</span>', 'buddypress' ), count( $notifications ) );
     164    } else {
     165        $menu_title = __( 'Notifications', 'buddypress' );
     166    }
     167   
     168    // Add the top-level Notifications button
     169    $wp_admin_bar->add_menu( array(
     170        'id'    => 'notifications',
     171        'title' => $menu_title,
     172        'href'  => bp_loggedin_user_domain()
     173    ) );
     174   
     175    if ( !empty( $notifications ) ) {
     176        foreach ( (array)$notifications as $notification ) {
     177            $wp_admin_bar->add_menu( array(
     178                'parent' => 'notifications',
     179                'id'     => 'notification-' . $notification->id,
     180                'title'  => $notification->content,
     181                'href'   => $notification->href
     182            ) );
     183        }
     184    } else {
     185        $wp_admin_bar->add_menu( array(
     186            'parent' => 'notifications',
     187            'id'     => 'no-notifications',
     188            'title'  => __( 'No new notifications', 'buddypress' ),
     189            'href'   => bp_loggedin_user_domain()
     190        ) );
     191    }
     192   
     193    return;
     194}
     195add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_notifications_menu', 999 );
    149196
    150197/**
  • trunk/bp-members/bp-members-notifications.php

    r4605 r4620  
    4444}
    4545
    46 function bp_core_get_notifications_for_user( $user_id ) {
     46function bp_core_get_notifications_for_user( $user_id, $format = 'simple' ) {
    4747    global $bp;
    4848
     
    7272            if ( isset( $bp->{$component_name}->format_notification_function ) && function_exists( $bp->{$component_name}->format_notification_function ) ) {
    7373                $renderable[] = call_user_func( $bp->{$component_name}->format_notification_function, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count );
    74             } elseif ( isset( $bp->{$component_name}->notification_callback ) && function_exists( $bp->{$component_name}->notification_callback ) ) {
    75                 $renderable[] = call_user_func( $bp->{$component_name}->notification_callback, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count );
     74            } elseif ( isset( $bp->{$component_name}->notification_callback ) && function_exists( $bp->{$component_name}->notification_callback ) ) {
     75                if ( 'object' == $format ) {
     76                    $content = call_user_func( $bp->{$component_name}->notification_callback, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count, 'array' );
     77                   
     78                    // Minimal backpat with non-compatible notification
     79                    // callback functions
     80                    if ( is_string( $content ) ) {
     81                        $notification->content = $content;
     82                        $notification->href    = bp_loggedin_user_domain();
     83                    } else {
     84                        $notification->content = $content['text'];
     85                        $notification->href    = $content['link'];
     86                    }
     87                   
     88                    $renderable[]          = $notification;
     89                } else {
     90                    $content = call_user_func( $bp->{$component_name}->notification_callback, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count );
     91                    $renderable[] = $content;
     92                }
    7693            }
    7794        }
Note: See TracChangeset for help on using the changeset viewer.