BuddyPressで「アバター画像設定」を「設定」のサブメニューに移動する

bp-custom.phpに下記を記入します。

//設定の下にアバター画像を設定を移動

function add_settings_subnav_tab() {
        global $bp;
        // rename general settings tab
        $bp->bp_options_nav['settings']['general']['name'] = 'アカウント設定';
        // remove profile menu tab
        unset($bp->bp_nav['profile']);
        // add 'Change profile picture' sub-menu tab
        bp_core_new_subnav_item( array(
                'name' => 'アバター画像を設定',
                'slug' => 'change-profile-picture',
                'parent_url' => $bp->loggedin_user->domain . $bp->bp_nav['settings']['slug'] . '/',
                'parent_slug' => $bp->bp_nav['settings']['slug'],
                'screen_function' => 'change_profile_picture',
                'position' => 30
                )
        );
}
 
function change_profile_picture(){
         
        add_action( 'bp_template_content', 'change_profile_picture_screen_content' );
        xprofile_screen_change_avatar();   
}
 
add_filter('xprofile_template_change_avatar', 'filter_changeavatar_template');

function filter_changeavatar_template($template){
    return 'members/single/plugins';
}

function change_profile_picture_screen_content() {
        bp_get_template_part( 'members/single/profile/change-avatar' );
}

add_action( 'bp_setup_nav', 'add_settings_subnav_tab', 100 );