bp_messages_<action>_notification

Filters the custom action notification before the notification is created.

Description

apply_filters( 'bp_messages_<action>_notification', (array) $return, (int) $item_id, (int) $secondary_item_id, (number) $total_items, (string) $format ); 

This is a dynamic filter based on the message notification action.

Parameters (5)

0. $return (array)
An associative array containing the text and the link of the notification
1. $item_id (int)
ID of the associated item.
2. $secondary_item_id (int)
ID of the secondary associated item.
3. $total_items (number)
Number of messages referred to by the notification.
4. $format (string)
Return value format. string for BuddyBar-compatible notifications; array. for WP Toolbar. Default: string .

Usage

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

Defined (1)

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

/bp-messages/bp-messages-notifications.php  
  1. $return = apply_filters( "bp_messages_{$action}_notification", $return, $item_id, $secondary_item_id, $total_items, $format );