Reply To: How do I move profile subnavs to Settings subnav
@josephfrio13yahoocom you have a fine question. I am one step away from being able to answer it for you. I know how to create and delete subnavs, and I know how to set up screen functions for the subnavs I create. But I am not yet able to connect a new subnav with an existing BuddyPress screen function.
I tried the following code last night, but was unsuccessful:
function setup_custom_nav() {
global $bp;
bp_core_new_subnav_item( array(
'name' => __( 'Change Avatarr', 'buddypress' ),
'slug' => 'change-avatarr',
'parent_url' => $bp->loggedin_user->domain . 'settings/',
'parent_slug' => 'settings',
'screen_function' => 'lf_screen_function',
'position' => 30,
) );
}
add_action( 'bp_setup_nav', 'setup_custom_nav');
function lf_screen_function() {
add_action( 'bp_template_content', 'xprofile_screen_change_avatar' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}
What I get from this is another whole site-generator division inside the already existing one. I get the same thing if I put ‘xprofile_screen_change_avatar’ in directly for the screen function.
I’m getting the screen function from here: https://github.com/buddypress/BuddyPress/blob/12bc8cb1b6000d73be2d43e1c34e26c42b5ff215/src/bp-xprofile/bp-xprofile-loader.php#L216