Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to: Modify the bp admin bar

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

  • thebigk
    Participant

    @thebigk

    *bump*

    I want to add link titled ‘Help’ to the admin bar which will point to the static ‘Help’ pages on my site. How can I do that?


    Burt Adsit
    Participant

    @burtadsit

    I have a special fondness for the admin bar. It was the first thing I started modifying in bp.

    You’ve got to create a new function that responds to the action ‘bp_adminbar_menus’. Something like this:

    function my_help_link(){
    ?>
    <li><a href="http://someplace.org">Help</a>

    <ul class="your-ul-list-css-classname">
    <li><a href="http://someplace.org">Help 1</a></li>
    <li class="alt"><a href="http://someplace.org">Help 2</a></li>
    <li><a href="http://someplace.org">Help 3</a></li>
    <li class="alt"><a href="http://someplace.org">Help 4</a></li>
    <li><a href="http://someplace.org">Help 5</a></li>
    </ul>

    </li>
    <?php
    }
    add_action( 'bp_adminbar_menus', 'my_help_link', 14 );

    Here with formatting: http://pastie.org/451047

    The call add_action() has a number at the end which is the ‘priority’. When the fn gets triggered in the great scheme of things. If you look at the code for the admin bar in /bp-core/bp-core-adminbar.php, you’ll see a bunch of calls like this at the end of the file. They setup the sequence for the menu items. Lower priority numbers get run first and the corresponding menu item shows up first.

    I gave our little help item a priority of 14 so it shows up at the end of the normal menu item sequence. If you want to slide it in between menu items that have a priority of 4 and 6 then give your help add_action() call a priority of 5.


    Burt Adsit
    Participant

    @burtadsit

    Oh ya. the class=”alt” css things are what alternate the colors in the drop down. You can just drop whatever function you do create in bp-custom.php along with the add_action() call and it works pretty slick.


    Tutsie
    Participant

    @tutsie

    How could I go about adding the bp admin bar to the top of my wordpress back end admin pages?


    hyrxx
    Participant

    @hyrxx

    is it possible to have the admin menu start on the buddypress image, rather than my account,

    i plan to rewrite all the menu items when i redesign my site, and i want to attach a menu to the buddypress ‘home’ link


    Burt Adsit
    Participant

    @burtadsit

    @Tutsie, upgrade to RC2/trunk. That feature was added some time ago.

    @Hyrxx, you’d have to move the logo into the actual <ul><li> structure of the menu itself. Right now it sits outside of that. It’s not really part of the menu as of now. I just finished doing a tutorial on altering the admin bar as part of this thread: https://buddypress.org/forums/topic.php?id=2283

    Believe it or not I’m getting kinda burned out on the admin bar. I know it’s one of the most visible aspects of bp. It is also one of the easiest ways to allow your users to navigate to important areas of your site. I just don’t have time to tackle that right now. I have a project I’m working on that needs attention.


    thebigk
    Participant

    @thebigk

    @ Burtadsit: Thanks a ton for all your help. I just got my link up! :D YO!


    hyrxx
    Participant

    @hyrxx

    im pretty good with modifying it, i just dont want to modify the actual files, what is the best way to implement a plugin kinda thing to tell bp the actual html to use?


    TheEasyButton
    Participant

    @theeasybutton

    Thank you Burt Adsit for that code. Like Hyrxx I was trying to figure out how to change the bar without hacking into the core. Does no good to make a template to share with others if they have to hack the core.

    Hyrxx, to make the change that Burt Adsit explained, I simply pasted his code into the bottom of the functions.php in my theme.


    dwpers
    Participant

    @dwpers

    https://codex.buddypress.org/developer-docs/modifying-the-buddypress-admin-bar/

    = “Error! This blog has been archived or suspended.”

    Nice – thanks for the quick function Burt!


    intimez
    Participant

    @intimez

    I pasted Burt’s code to the end of function.php and I get a blank page

    Did I miss something?

    [wordpress2.9.2 + buddypress1.2.1]


    intimez
    Participant

    @intimez

    Anyone? Just looking for a little guidance so I can give this a try. Additional modification needed for the code? Need to paste it in a particuliar section of a file?


    designodyssey
    Participant

    @designodyssey

    Burt was using version 1 of BP. Sounds like some tweaking is necessary for V1.2


    Jens Wedin
    Participant

    @jedisthlm

    Would be great if the tutorial could be updated or if anyone knows what to do?


    dennissmolek
    Participant

    @dennissmolek

    I removed the bar completely and replaced it with my own segment of code. you can copy bp-core-adminbar.php to get whatever it is you want but say you want a totally custom bar you’ll have to kill the original. heres how I did it:

    function ovc_adminbar() {
    require('ovcbar.php');

    remove_action( 'wp_footer', 'bp_core_admin_bar', 8 );
    }

    add_action('wp_footer','ovc_adminbar',1);

    ovcbar.php is where my markup is, the function name is ovc_admin bar..

    this is all in functions.php


    Vernon Fowler
    Participant

    @vernonfowler


    sdls
    Member

    @simon_said

    This worked perfectly thanks @dennissmolek
    one suggestion for those following this path….
    in ovcbar.php you can’t copy and paste the whole bp-core-adminbar.php
    you have too manually go in and copy paste the code from within the functions.

    Don’t forget to wrap it in:

    echo ‘

    ‘;
    echo ‘

    ‘;
    echo “

    nn”;

    so it format’s right.. …..thanks again


    Developer ICAN
    Participant

    @richardicanie

    Hi,

    I’ve trying to mimic the functionality of the BP admin bar in the latest release of BuddyPress – thats 1.9 – can someone point out how i can do this? I want to place it somewhere else on my site and t urn off the top one?

Viewing 19 replies - 1 through 19 (of 19 total)
  • The topic ‘How to: Modify the bp admin bar’ is closed to new replies.
Skip to toolbar