How to Add, Remove, and Change the Order Of BuddyPress Component Menu

Today I needed to change three things in a BuddyPress installation:

  1. Change the title of “Groups” to “My Conversations” in the BuddyPress component menu.
  2. Remove the “Forums” menu item from the BuddyPress component menu.
  3. Change the order of the BuddyPress component menu such that the “Messages” link is in a different place.

To accomplish these three things, I added the following to my theme’s functions.php file:


// Setup the navigation
// Props to http://wordpress.stackexchange.com/questions/16223/add-buddypress-profile-menu-item for helping me figure this out
// http://themekraft.com/customize-profile-and-group-menus-in-buddypress/
function my_setup_nav() {
      global $bp;

      // Change the order of menu items
      $bp->bp_nav['messages']['position'] = 100;

      // Remove a menu item
      $bp->bp_nav['conversations'] = false;

      // Change name of menu item
      $bp->bp_nav['communities']['name'] = 'My Conversations';
}

add_action( 'bp_setup_nav', 'my_setup_nav', 1000 );

Pretty nifty, eh?

By the way, if you want to see all of your options for editing the components menu, just throw the following into functions.php:


function bp_dump() {
    global $bp;
 
    foreach ( (array)$bp as $key => $value ) {
        echo '
'; echo '' . $key . ':
;'; print_r( $value ); echo '
'; } die; }

(Thanks ThemeKraft!)

Posted in ,

The Mighty Mo! Design Co.

3 Comments

  1. Rick Roberts on February 7, 2012 at 10:22 pm

    Thank you so much for posting this solution. It worked almost perfectly. There is a partial tab left over on the left side, and I can’t figure out where that is coming from. Picture here: http://d.pr/vqh4



    • toby on February 16, 2012 at 3:40 am

      I don’t know… Let me know if you solve the problem, so I can post the solution here.



  2. mecanographik on March 2, 2012 at 9:47 am

    Hey, i have a found a way to hide the partial tab with just a bit of css in your bp child theme stylesheet :

    div.item-list-tabs ul #-personal-li{display:none;}

    i’m sure there is a way to do it with a hook on the bp_get_displayed_user_nav function, but i couldn’t figure it out !



RSS From Toby’s Blog

  • The Horrors of Covering Your Own Ass
    Today I emailed a very simple question to support@[companyname].com (2 sentences total). The automated response I got back was this: Keep in mind that the above was an auto-response and: It’s hard to read. Everything has the same import (e.g. none of it is important enough to call out separately). It’s long. It added absolutely-zero…
  • If something stupid makes money, then it’s not stupid.
    I’ve seen some stupid things in my life…And some of them were really really smart. I remember a story from decades ago where the U.S. military was looking to equip the Stealth Bomber with a fancy computer-driven video system so the pilots could see behind them. Well, the computers failed to get the job done,…
  • There is no destination.
    Coding is a process of failure followed by a moment of great joy. You've gotta ride through the failures to experience the joy...

More posts from themightymo.com

Avada ThemeFusion loads 80+ javascript files on every page! DON’T RECOMMEND!

By The Mighty Mo! Design Co. | November 18, 2021

I inherited a WordPress site using Avada ThemeFusion, and it is experiencing really bad performance issues. After doing lots of my standard bag-of-tricks optimizations to little effect, I decided to simply count the javascript files. To my surprise horror, I found it was loading over 80 javascript files on every single page! (For comparison: themightymo.com…

Why I switched from WPMUDEV’s Defender Pro to WordFence for WordPress Security

By The Mighty Mo! Design Co. | November 12, 2021

A while back, I started using WPMUDEV’s Defender Pro plugin for security on all my WordPress sites. I made a decision this week to switch to WordFence. The conversation was forced on me, because I had a site using Defender Pro that was hacked. I do not blame Defender Pro for the hack, however, this…

minneapolis wordpress design logo

How to Preload Font in WordPress Functional Plugin

By The Mighty Mo! Design Co. | August 5, 2021

use a plugin to do a bunch of optimizations on this site, but for some reason, the preloading of fonts is broken. So I rolled my own font preloading function and placed it in my functional plugin (You could also put it in functions.php). Here’s the code.

RSS From Toby’s Blog

  • The Horrors of Covering Your Own Ass
    Today I emailed a very simple question to support@[companyname].com (2 sentences total). The automated response I got back was this: Keep in mind that the above was an auto-response and: It’s hard to read. Everything has the same import (e.g. none of it is important enough to call out separately). It’s long. It added absolutely-zero…
  • If something stupid makes money, then it’s not stupid.
    I’ve seen some stupid things in my life…And some of them were really really smart. I remember a story from decades ago where the U.S. military was looking to equip the Stealth Bomber with a fancy computer-driven video system so the pilots could see behind them. Well, the computers failed to get the job done,…
  • There is no destination.
    Coding is a process of failure followed by a moment of great joy. You've gotta ride through the failures to experience the joy...