Skip to content

Instantly share code, notes, and snippets.

@alokstha1
Last active September 15, 2015 03:58
Show Gist options
  • Save alokstha1/ed565e374beae5379e09 to your computer and use it in GitHub Desktop.
Save alokstha1/ed565e374beae5379e09 to your computer and use it in GitHub Desktop.
BuddyPress Profile navigation
<?php
function profile_nav_item() {
global $bp;
bp_core_new_subnav_item(
array(
'name' => __( 'User Profile', 'buddypress' ),
'slug' => 'user-profile',
'position' => 10,
'screen_function' => 'user_listingsdisplay',
'default_subnav_slug' => 'user-profile',
'parent_url' => $bp->displayed_user->domain . $bp->profile->slug . '/',
'parent_slug' => $bp->profile->slug,
'user_has_access' => current_user_can('edit_users'),
) );
}
function user_listingsdisplay() {
//add title and content here - last is to call the members plugin.php template
add_action( 'bp_template_title', 'my_groups_page_function_to_show_screen_title' );
add_action( 'bp_template_content', 'my_groups_page_function_to_show_screen_content' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}
function my_groups_page_function_to_show_screen_title() {
echo 'My new Page Title';
}
function my_groups_page_function_to_show_screen_content() {
echo 'My Tab content here';
}
add_action( 'bp_setup_nav', 'profile_nav_item', 50 );
/* end of user profile */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment