Skip to:
Content
Pages
Categories
Search
Top
Bottom

Move subnav to other tab


  • Schweizer Solutions GmbH
    Participant

    @schweizersolutions

    Hello!

    I moved the “Change avatar” and “Change cover” subnavs from the tab “Profile” to “Setting”. It works good, but no content is displayed … I don’t know why, because the function “xprofile_screen_change_avatar” is triggered.

    Does anybody has an idea?

    Here is my code from the functions.php:

    
    function custom_bp_menu_tabs() {
        global $bp;
    
        if ( bp_is_active( 'xprofile' ) ):
            $change_avatar = $bp->bp_options_nav['profile']['change-avatar']->backcompat_nav;
    
            if ( ! empty( $change_avatar ) ) {
                $change_avatar['parent_slug'] = $bp->bp_nav['settings']['slug'];
                $change_avatar['parent_url']  = $bp->loggedin_user->domain . $bp->bp_nav['settings']['slug'] . '/';
                unset( $change_avatar['link'] );
    
                bp_core_remove_subnav_item( $bp->bp_nav['profile']['slug'], $change_avatar['slug'] );
                bp_core_new_subnav_item( $change_avatar );
            }
    
            bp_core_remove_nav_item( 'profile' );
    
            bp_core_remove_subnav_item( $bp->bp_nav['settings']['slug'], 'notifications' );
            bp_core_remove_subnav_item( $bp->bp_nav['settings']['slug'], 'profile' );
        endif;
    }
    
    add_action( 'bp_setup_nav', 'custom_bp_menu_tabs', 9999 );
    
  • You must be logged in to reply to this topic.
Skip to toolbar