How to Add a New Menu Item to the BuddyPress Component Menu
January 25th, 2012 — Blog Post, BuddyPress, Wordpress
Today I needed to add a new menu item to the BuddyPress components menu (the menu under the profile with “Settings”, “Groups”, “Forums”, “Profile”, etc.).
In my example below, the menu item will be called, “My Conversations”, and it will link to the “Groups” template.
<?php // Setup the navigation // Props to http://wordpress.stackexchange.com/questions/16223/add-buddypress-profile-menu-item for helping me figure this out // and http://themekraft.com/customize-profile-and-group-menus-in-buddypress/ function my_setup_nav() { global $bp; bp_core_new_nav_item( array( 'name' => __( 'My Conversations', 'buddypress' ), 'slug' => 'my-all-conversations', 'position' => 75, 'screen_function' => 'my_all_conversations_link', 'show_for_displayed_user' => true, 'default_subnav_slug' => 'my-all-conversations', 'item_css_id' => 'my-all-conversations' ) ); } add_action( 'bp_setup_nav', 'my_setup_nav', 1000 ); function my_all_conversations_title() { echo 'My Conversations'; } function my_all_conversations_content() { ?> <div id="groups-dir-list" class="groups dir-list"> <?php locate_template( array( 'groups/groups-loop.php' ), true ) ?> </div><!-- #groups-dir-list --> <?php } function my_all_conversations_link () { add_action( 'bp_template_title', 'my_all_conversations_title' ); add_action( 'bp_template_content', 'my_all_conversations_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } ?>
That’s it! Enjoy!

