Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to split out BuddyPress notifications drop down items to their own top level


  • bp-help
    Participant

    @bphelp

    I would like to know how to do this, I am not a buddypress expert so It will take some explaining and even better some code on a github link. I would like to add this to my header and get rid of the toolbar, I would also like to add the BP links that is usually in the right of the toolbar into the the header. Reason being I don’t want that bar up there and it would make it look more custom without the toolbar that gives it away that it is a WP/BP social network. I like how facebook has their notifications, messages, and friend request split out. This is what I am trying to do. I got a little info on this link but not enough to do anything with : http://wordpress.stackexchange.com/questions/27888/how-to-split-out-buddypress-notifications-drop-down-items-to-their-own-top-level @boonebgorges explains it but not in much detail. I would appreciate any guidance on how to get this done. Thanks!

Viewing 25 replies - 1 through 25 (of 36 total)

  • bp-help
    Participant

    @bphelp

    Is there anyone who knows how to get this done? @naijaping did it on his BP site and I want to do the same please! What is the best course of action to accomplish this?


    Brajesh Singh
    Participant

    @sbrajesh

    Hi,
    Have a look at this function

    bp_core_get_notifications_for_user here https://github.com/buddypress/trunk/blob/master/bp-members/bp-members-notifications.php#L83

    You can modify it to suit your need(this is the one that generates the notfication messages).

    and here you can see how the drop down is created
    https://github.com/buddypress/trunk/blob/master/bp-members/bp-members-buddybar.php#L18

    Hope that helps.


    bp-help
    Participant

    @bphelp

    @sbrajesh Could you create a plugin that would do this and hook into the header in bp-default because your more qualified than me because I am kinda a noob? Thank you!


    Brajesh Singh
    Participant

    @sbrajesh

    Do you want it to be hooked to the main menu of the bp-default theme when a user is logged in ?


    bp-help
    Participant

    @bphelp

    @sbrajesh That would be nice if you could do it, and make it dynamic for each users notifications. You will be my hero if this can be done. Thank you!


    bp-help
    Participant

    @bphelp

    @sbrajesh Any news on this? Thanks a million!


    bp-help
    Participant

    @bphelp

    @sbrajesh actually I would like to get it like facebooks notifications somewhere in the header using similar icons to dispay friend requests, messages, notifications and when you have anything then the icon will display accordingly just like facebooks. If anyone can offer assistance I would appreciate it.


    @mercime
    Participant

    @mercime


    bp-help
    Participant

    @bphelp

    @mercime Thanks but that is not going to accomplish what I am attempting to do. I can’t find anything in the codex that explains how this would be done either. The codex helped me figured out a lot of stuff about customizing BP but there doesn’t seem to be any documentation about notifications in the codex or on google. Is there anyone you can direct me too that could explain how I can get this done or better yet add some documentation to the codex regarding notifications? I would be very grateful to anyone that can help me resolve this. Thanks for your help!


    bp-help
    Participant

    @bphelp

    @sbrajesh @mercime @naijaping
    This is a rough draft of what I would like to do. All icons functional, and only appearing in header after the user is logged in. I hope this will help explain what I am doing. Thanks everyone!
    split out notifications


    bp-help
    Participant

    @bphelp

    Is there any BP Professionals who can help me on this? I surely would appreciate it! Thanks a million!


    danbpfr
    Participant

    @chouf1

    @bphelp,

    i’m not sure of what you exactly want, but here’s something who gives you a header menu based on text links who leading to the expected member part. The example given here works on bp-default 1.6.4 (may also work on previous versions)

    What to do ?
    add an action call in your theme’s header.php
    add a function in your theme functions.php

    in header.php, after the h1 closing tag, add
    <?php do_action ( 'my_header_menu_bar' );?>

    add this function to your theme functions.php

    function my_header_menu () {
    if ( is_user_logged_in() ) { ?>
    <div style="display:inline; width: 200px;float:left; ">
    <a href="<?php echo bp_loggedin_user_domain() . bp_get_friends_slug(); ?>/requests/">Friends request</a>&nbsp;
    <a href="<?php echo bp_loggedin_user_domain() . bp_get_messages_slug(); ?>/view/">Messages</a>&nbsp;
    <a href="<?php echo bp_loggedin_user_domain() . bp_get_messages_slug(); ?>/notices/">Notices</a>
    </div>
    <?php
    }
    }
    add_action ( 'my_header_menu_bar', 'my_header_menu' );

    This is a rought example. You can now add img tag to replace the text in each a tag and play with css to style the div contained in the function (actually containing inline style). If you give it a class name, you can add the style to your theme style file.


    bp-help
    Participant

    @bphelp

    @chouf1 Hey thanks for your help. Is there anyway to get the number of these individual types of notifications you have beside the links or image kinda like it does in the toolbar? Cheers!


    bp-help
    Participant

    @bphelp

    @chouf1 Also what about creating a dropdown menu? Thanks again!


    maddogmcewan
    Participant

    @maddogmcewan

    Hi not sure if this is what you are trying to do, if you go to http://smeak.com you can see it at work, we split the notifications intro 3, and into a custom toolbar we built for the network. Let me know to see if we can help

    notifications on new toolbar


    bp-help
    Participant

    @bphelp

    @maddogmcewan That looks great. I will accept any help you can share. Thanks! 🙂


    danbpfr
    Participant

    @chouf1

    here’re the 3 counter. Their names are explicit enough i guess to see the right place where to use 😉

    echo bp_friend_get_total_requests_count( $user_id );

    echo bp_get_total_unread_messages_count($name );

    echo count($notifications);


    bp-help
    Participant

    @bphelp

    @chouf1 with your help and hnla’s I have this working but even with the above examples in how to get the counts in a drop down I am not certain how to do this. Where do I place:

    echo bp_friend_get_total_requests_count( $user_id );

    echo bp_get_total_unread_messages_count($name );

    echo count($notifications);

    In the code because it either fires off an error or it actually echo’s the code. What am I doing wrong? Thanks again for all your help! 🙂
    `
    function custom_toolbar($wp_toolbar) {
    global $wp_admin_bar;

    if ( is_user_logged_in() ) {

    $wp_toolbar->add_node(array(
    ‘id’ => ‘bp-notifications’,
    ‘title’ => __(‘ ‘),
    ‘href’ => bp_loggedin_user_domain() . bp_get_messages_slug() . ‘/notices/’,
    /*’meta’ => array(‘class’ => ‘notifications’)*/
    ));

    $wp_toolbar->add_node(array(
    ‘id’ => ‘user-friends’,
    ‘title’ => __(‘ ‘),
    ‘href’ => bp_loggedin_user_domain() . bp_get_friends_slug() . ‘/requests/’,
    /*’meta’ => array(‘class’ => ‘menupop’)*/
    ) );

    $wp_toolbar->add_node(array(
    ‘id’ => ‘user-messages’,
    ‘title’ => __(‘ ‘),
    ‘href’ => bp_loggedin_user_domain() . bp_get_messages_slug() . ‘/view/’,
    /*’meta’ => array(‘class’ => ‘menupop’)*/
    ) );
    }
    }
    add_action(‘admin_bar_menu’, ‘custom_toolbar’, 999);
    `


    bp-help
    Participant

    @bphelp

    Hi @chouf1, just wondering if you could help me a little more with the above code. I don’t mean to bump this but with people not getting there @mentions notifications here I am afraid it will be overlooked. Thank you kindly!


    danbpfr
    Participant

    @chouf1

    i have already helped you here for the same question: https://buddypress.org/support/topic/how-to-add-images-to-a-custom-toolbar/#post-156520

    Let me tell you that you don’t ask for help now, but search somebody doing that plugin at your place. 👿

    Go to the job board and hire a dev, if you don’t know go further with all the elements you already received. I’m not at your personal service !


    bp-help
    Participant

    @bphelp

    @chouf1 No need in being nasty about it. I just thought you didn’t mind helping me since you had helped me before. I’m sorry! Anyway thanks for the other help you given it is appreciated.
    🙂


    bp-help
    Participant

    @bphelp

    Is there anyone else that would not mind helping me out on this? Thank you everyone! 🙂


    bp-help
    Participant

    @bphelp

    I still would appreciate some help on this! Thanks everyone! 🙂


    bp-help
    Participant

    @bphelp

    Anyone who can help? Thanks!


    bp-help
    Participant

    @bphelp

    Just for clarification I decided to keep the toolbar and attempt to add the split up notifications to it. I just need help with display of the individual notifications in the drop-down menu.

Viewing 25 replies - 1 through 25 (of 36 total)
  • The topic ‘How to split out BuddyPress notifications drop down items to their own top level’ is closed to new replies.
Skip to toolbar