Skip to:
Content
Pages
Categories
Search
Top
Bottom

Removing message notifications from buddypress bar


  • jetlej
    Participant

    @jetlej

    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()

Viewing 6 replies - 1 through 6 (of 6 total)

  • Mary Jane
    Member

    @jasonbrodbeckcom

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


    jetlej
    Participant

    @jetlej

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


    jetlej
    Participant

    @jetlej

    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;
    } `


    jetlej
    Participant

    @jetlej

    Anyone? :)


    jetlej
    Participant

    @jetlej

    *Hopeful bump*

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Removing message notifications from buddypress bar’ is closed to new replies.
Skip to toolbar