Skip to:
Content

BuddyPress.org

Ticket #5970: bp-friends-notifications-5970.diff

File bp-friends-notifications-5970.diff, 2.3 KB (added by tw2113, 10 years ago)
  • src/bp-friends/bp-friends-notifications.php

     
    136136                case 'friendship_accepted':
    137137                        $link = trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends' );
    138138
     139                        $action = 'accepted';
     140
    139141                        // Set up the string and the filter
    140142                        if ( (int) $total_items > 1 ) {
    141143                                $text = sprintf( __( '%d friends accepted your friendship requests', 'buddypress' ), (int) $total_items );
    142                                 $filter = 'bp_friends_multiple_friendship_accepted_notification';
     144                                $amount = 'multiple';
    143145                        } else {
    144146                                $text = sprintf( __( '%s accepted your friendship request', 'buddypress' ),  bp_core_get_user_displayname( $item_id ) );
    145                                 $filter = 'bp_friends_single_friendship_accepted_notification';
     147                                $amount = 'single';
    146148                        }
    147149
    148150                        break;
     
    150152                case 'friendship_request':
    151153                        $link = bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/?new';
    152154
     155                        $action = 'request';
     156
    153157                        // Set up the string and the filter
    154158                        if ( (int) $total_items > 1 ) {
    155159                                $text = sprintf( __( 'You have %d pending friendship requests', 'buddypress' ), (int) $total_items );
    156                                 $filter = 'bp_friends_multiple_friendship_request_notification';
     160                                $amount = 'multiple';
    157161                        } else {
    158162                                $text = sprintf( __( 'You have a friendship request from %s', 'buddypress' ),  bp_core_get_user_displayname( $item_id ) );
    159                                 $filter = 'bp_friends_single_friendship_request_notification';
     163                                $amount = 'single';
    160164                        }
    161165
    162166                        break;
     
    164168
    165169        // Return either an HTML link or an array, depending on the requested format
    166170        if ( 'string' == $format ) {
    167                 $return = apply_filters( $filter, '<a href="' . esc_url( $link ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $item_id );
     171                $return = apply_filters( 'bp_friends_' . $amount . '_friendship_' . $action . '_notification', '<a href="' . esc_url( $link ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $item_id );
    168172        } else {
    169                 $return = apply_filters( $filter, array(
     173                $return = apply_filters( 'bp_friends_' . $amount . '_friendship_' . $action . '_notification', array(
    170174                        'link' => $link,
    171175                        'text' => $text
    172176                ), (int) $total_items, $item_id );