public
Last active

There is a problem here somewhere

  • Download Gist
Buddypress add new profile tab
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
/* new menu item */
 
add_action( 'bp_setup_nav', 'add_ideas_nav_tab', 997 );
function add_ideas_nav_tab() {
global $bp;
bp_core_new_nav_item( array(
'name' => __( 'Ideas', 'bp-ideas' ),
'slug' => 'ideas',
'show_for_displayed_user' => true,
'position' => 49,
'default_subnav_slug' => 'ideas',
'screen_function' => 'ideas_screen',
) );
}
 
function ideas_screen() {
add_action( 'bp_template_content', 'ideas_screen_show' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'buddypress/members/single/plugins' ) );
}
 
 
function ideas_screen_show() {
// call template
locate_template( array( 'buddypress/members/single/ideas.php' ), true );
 
}
 
add_action( 'bp_setup_nav', 'add_ideas_subnav_tab', 100 );
function add_ideas_subnav_tab() {
global $bp;
bp_core_new_subnav_item( array(
'name' => __( 'My ideas', 'bp-my-ideas' ),
'slug' => 'ideas',
'parent_url' => trailingslashit( bp_loggedin_user_domain() . 'ideas' ),
'parent_slug' => 'ideas',
'screen_function' => 'profile_screen_ideas',
'position' => 50
)
);
}
 
// show ideas when 'Ideas' tab is clicked
function profile_screen_ideas() {
add_action( 'bp_template_content', 'profile_screen_ideas_show' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'buddypress/members/single/plugins' ) );
}
 
function profile_screen_ideas_show() {
 
 
// call template
locate_template( array( 'buddypress/members/single/ideas.php' ), true );
 
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.