Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding links to admin bar


  • confusednewbie
    Member

    @confusednewbie

    Feel a bit silly asking this, because I am a proper newbie with wordpress MU and buddypress.

    I want to admin some hard links to the admin bar, how would I add an ‘Example’ (example.com) button to the bar? Would I keep having to update something in bp-core-adminbar.php with every upgrade?

    Thanks!

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

  • vsellis
    Participant

    @vsellis

    I’m working on this too. From what I can tell you have to essentially hack some core code which I’m relatively comfortable doing but don’t really want to.

    I’ve temporarely used css to position the links where I want them but they don’t slide as more links are added when the user is logged in vs. when they are no so there is overlap. uh..

    Any suggestions out there?


    Burt Adsit
    Participant

    @burtadsit

    You can supply your own admin bar if you like. From /bp-core/bp-core-adminbar.php:

    add_action( ‘bp_adminbar_logo’, ‘bp_adminbar_logo’ );

    add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_login_menu’, 2 );

    add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_account_menu’, 4 );

    add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_blogs_menu’, 6 );

    add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_notifications_menu’, 8 );

    add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_authors_menu’, 12 );

    add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_random_menu’, 100 );

    Those are the actions that are triggered for each of the major menu sections. For ‘my account’ it’s the function bp_adminbar_account_menu(). In bp-custom.php, make one if you don’t have one, do:

    remove_action( ‘bp_adminbar_menus’, ‘bp_adminbar_account_menu’, 4 );

    add_action( ‘bp_adminbar_menus’, ‘my_account_menu’, 4 );

    function my_account_menu(){

    <your stuff here for the account menu>

    }


    gpo1
    Participant

    @gpo1

    I want to add

    Home

    Blog

    Members

    Groups

    Blogs

    in the admin bar on members theme to replace these in the original layout. what’s the code to do it?


    Burt Adsit
    Participant

    @burtadsit

    gpo1, I’m sure there are programmers around the forums that can do this for you if you don’t have the time to research and implement this.


    enlightenmental1
    Participant

    @enlightenmental1

    question

    I’ve hand coded the bp-core-admin-bar.php to add additional links

    and add a If(user_is_logged_in) so I can switch links when the user logs in..

    but my li / ul aren’t creating droppdowns

    example

    
    <li> main link </li>
    <ul>
    <li>sub link</li>
    <li>sub link</li>
    </ul>

    instead of getting the sub-links to show as a dropdown, they show up as new “main links”

    I am aware of the no-arrow class but are there more css classes to add to these items to make them become a drop down?

    here’s my complete code:


    belogical
    Participant

    @belogical

    sounds like a project for the new group “Code Snippets Solution Library”


    enlightenmental1
    Participant

    @enlightenmental1

    echo "<ul class="main-nav">";
    
    echo "<li >Main Link</li >";
    
    echo "<ul >";
    
    echo "<li >sub link</li >";
    
    echo "<li >sub link</li >";
    
    echo "<li >sub link</li >";
    
    echo "<li >sub link</li >";
    
    echo "<ul >";
    
    echo "</ul >";
    

    why doesnt the above create a dropdown in the admin bar?


    enlightenmental1
    Participant

    @enlightenmental1

    figured it out

    wow… I’ve never seen a list item like this… had me very confused

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Adding links to admin bar’ is closed to new replies.
Skip to toolbar