Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Removing message notifications from buddypress bar

@jetlej

Participant

Progress: I found the BP function in the core and figured out how to alter it to achieve the effect, but I can’t figure out how to do this in the function.php file instead of altering the core file.

The function:

`function bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $secondary_item_id = 0, $date_notified = false ) {
global $bp;

if ( empty( $date_notified ) )
$date_notified = bp_core_current_time();

$notification = new BP_Core_Notification;
$notification->item_id = $item_id;
$notification->user_id = $user_id;
$notification->component_name = $component_name;
$notification->component_action = $component_action;
$notification->date_notified = $date_notified;
$notification->is_new = 1;

if ( !empty( $secondary_item_id ) )
$notification->secondary_item_id = $secondary_item_id;

if ( !$notification->save() )
return false;

return true;
}`

and adding the following above return true; made it work:

` if ( $component_name == ‘messages’ ){
return false;
}

if ( $component_action == ‘friendship_request’ ){
return false;
} `

Skip to toolbar