Add BuddyPress Profile Menu Item

In BuddyPress, when a user clicks on their username, they are presented with a page that contains a menu:

Activity
Profile
Messages
Friends
Groups
Settings

How do I add an item to this menu?

How do display this menu inside my template? (The default page template only displays the main navigation.)

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Here’s an example of adding a menu items pointing to custom templates. If you want to link to existing BP elements, you’ll need to look up the appropriate action. Add this to functions.php:

// Set up Cutsom BP navigation
function my_setup_nav() {
      global $bp;

      bp_core_new_nav_item( array( 
            'name' => __( 'Item One', 'buddypress' ), 
            'slug' => 'my-item-one', 
            'position' => 30,
            'screen_function' => 'my_item_one_template', 
      ) );

      bp_core_new_nav_item( array(
            'name' => __( 'Item Two', 'buddypress' ),
            'slug' => 'my-item-two',
            'position' => 20,
            'screen_function' => 'my_item_two_template' 
      ) );

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

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

      // Change name of menu item
      $bp->bp_nav['groups']['name'] = ‘community’;
}

add_action( 'bp_setup_nav', 'my_setup_nav' );


// Load a page template for your custom item. You'll need to have an item-one-template.php and item-two-template.php in your theme root.
function my_item_one_template() {
      bp_core_load_template( 'item-one-template' );
}

function my_item_two_template() {
      bp_core_load_template( 'item-two-template' );
}

Hope that helps! More at this article on Themekraft.

Method 2

Check out the BuddyPress Custom Profile Menu plugin.

You should be able to add tabs just by creating a regular WordPress menu.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x