bp_friends_<amount>_friendship_<action>_notification

Filters the format of friendship notifications based on type and amount * of notifications pending.

Description

apply_filters( 'bp_friends_<amount>_friendship_<action>_notification', (string) $a_href_esc_url_link_esc_html_text_a, (int) $int_total_items, (int) $item_id ); 

This is a variable filter that has four possible versions. The four possible versions are: - bp_friends_single_friendship_accepted_notification - bp_friends_multiple_friendship_accepted_notification - bp_friends_single_friendship_request_notification - bp_friends_multiple_friendship_request_notification

Parameters (3)

0. $a_href_esc_url_link_esc_html_text_a — Optional. (string) => '' . esc_html( $text ) . ''
Depending on format, an HTML link to new requests profile tab or array with link and text.
1. $int_total_items (int) => (int) $total_items
The total number of messaging-related notifications waiting for the user.
2. $item_id (int)
The primary item ID.

Usage

To run the hook, copy the example below.
  1. $a_href_esc_url_link_esc_html_text_a = apply_filters( 'bp_friends_{$amount}_friendship_{$action}_notification', $a_href_esc_url_link_esc_html_text_a, $int_total_items, $item_id ); 
  2.  
  3. if ( !empty( $a_href_esc_url_link_esc_html_text_a ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the bp_friends_<amount>_friendship_<action>_notification callback 
  2. function filter_bp_friends_amount_friendship_action_notification( $a_href_esc_url_link_esc_html_text_a, $int_total_items, $item_id ) { 
  3. // make filter magic happen here... 
  4. return $a_href_esc_url_link_esc_html_text_a
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "bp_friends_{$amount}_friendship_{$action}_notification", 'filter_bp_friends_amount_friendship_action_notification', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "bp_friends_{$amount}_friendship_{$action}_notification", 'filter_bp_friends_amount_friendship_action_notification', 10, 3 ); 

Defined (2)

The filter is defined in the following location(s).

/bp-friends/bp-friends-notifications.php  
  1. $return = apply_filters( 'bp_friends_' . $amount . '_friendship_' . $action . '_notification', '<a href="' . esc_url( $link ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $item_id ); 
  1. $return = apply_filters( 'bp_friends_' . $amount . '_friendship_' . $action . '_notification', array(