Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Removing message notifications from buddypress bar (7 posts)

Started 8 months, 1 week ago by: jetlej

  • Profile picture of jetlej jetlej said 8 months, 1 week ago:

    I’ve created a completely custom admin bar that works like that of Facebook with seprate menu items for notifications and messages. However I’m having trouble removing notifications about messages from displaying with bp_adminbar_notifications_menu()

  • Profile picture of Mary Jane Mary Jane said 8 months, 1 week ago:

    Sorry I am not answering your question but how ru using 1.5 on your site?

  • Profile picture of jetlej jetlej said 8 months, 1 week ago:

    I’m using the latest release candidate (which works great!). You can download it here: http://buddypress.org/2011/09/buddypress-1-5-release-candidate-1-and-buddypress-1-2-10/

  • Profile picture of jetlej jetlej said 8 months, 1 week ago:

    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;
    	}
  • Profile picture of jetlej jetlej said 8 months, 1 week ago:

    Anyone? :)

  • Profile picture of jetlej jetlej said 3 months, 1 week ago:

    *Hopeful bump*

  • Profile picture of Hugo Hugo said 3 months, 1 week ago:

    To remove notifications from buddybar:

    remove_action('bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8);

    The file you need to look in is buddypress/bp-members/bp-members-buddybar.php in core.

    You can then copy the function from there to use elsewhere as a template part include or similar and just remove the ul li elements that are not required.