BuddyDev

Search

[Resolved] remove settings from nav tab only

  • Participant
    Level: Yogi
    Posts: 1117
    calu on #46404

    Hi there, I want to remove the Settings tab from profile, but keep the settings option in menu items

    This function removes settings globally, how do I remove settings nav tab only?

    Regards
    Carsten

    function bphelp_remove_settings_from_profile(){
        bp_core_remove_nav_item('settings');
    }
    add_action('bp_settings_setup_nav','bphelp_remove_settings_from_profile');
    
  • Participant
    Level: Yogi
    Posts: 1117
    calu on #46418

    Hi there, There are several ways out there to remove a nav item, but what is the right way?

    false

    or

    bp_core_remove_nav_item

    And which one removes only the nav tab, but not the functionality?

    In my case the Settings, which I want to display in the Main menu of my theme only, not in BP navs?

    I hope you can bring some clarification to this topic.

    Regards
    Carsten

    Solution one:

    $bp->bp_nav[‘settings’] = false; (does not work)

    Solution two:

    
    function bphelp_remove_settings_from_profile(){
    bp_core_remove_nav_item('settings');
    }
    add_action('bp_settings_setup_nav','bphelp_remove_settings_from_profile');
     
    

    Solution three inclusive Group tabs:

    
    function bpex_hide_profile_menu_tabs() {
    
    	if( bp_is_active( 'xprofile' ) ) :
    
    	if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) {
    	//	BP's profile main menu items. Comment those to show.
    	//	bp_core_remove_nav_item( 'activity' );
    		bp_core_remove_nav_item( 'profile' );
    		bp_core_remove_nav_item( 'friends' );
    		bp_core_remove_nav_item( 'groups' );
    	//	exist only if you use bbPress
    		bp_core_remove_nav_item( 'forums' ); 
    
    	//	BP's profile main menu items. Comment those to show.
    	//	bp_core_remove_subnav_item( 'activity', 'personnal' );
    		bp_core_remove_subnav_item( 'activity', 'mentions' );
    		bp_core_remove_subnav_item( 'activity', 'favorites' );
    		bp_core_remove_subnav_item( 'activity', 'friends' );
    		bp_core_remove_subnav_item( 'activity', 'groups' );
    	}
    	endif; 
    }
    add_action( 'bp_setup_nav', 'bpex_hide_profile_menu_tabs', 15 );
    
    function bpex_remove_group_tabs() {  
    
    	if ( ! bp_is_group() ) {
    		return;
    	}
    
    	$slug = bp_get_current_group_slug();
    
    		// hide items to all users except site admin
    	if ( !is_super_admin() ) {
    
    	//	bp_core_remove_subnav_item( $slug, 'members' );
    		bp_core_remove_subnav_item( $slug, 'send-invites' );
    	//	bp_core_remove_subnav_item( $slug, 'admin' );
    	//	bp_core_remove_subnav_item( $slug, 'forum' );
    	}
    
    }
    add_action( 'bp_actions', 'bpex_remove_group_tabs' );
    
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #46419

    Hello Carsten,

    Thank you for posting. If you want to keep the functionality then a better way to remove the settings tab is to hide this tab using the CSS rule. If you are okay with this approach. Please let me know which template pack you are using.

    Regards
    Ravi

  • Participant
    Level: Yogi
    Posts: 1117
    calu on #46421

    Hello Ravi, thanks for your reply. I would prefer to remove the mark up as well, but if your recommendation is to use CSS I will do that.

    I’m using nouveau template pack.

    Regards
    Carsten

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #46422

    Hello Carsten,

    Thank you for the acknowledgement. Please try the following CSS rule:

    
    .users-nav #settings-personal-li {
        display: none;
    }
    
    

    Please try it and let me know if it helps or not.

    Regards
    Ravi

  • Participant
    Level: Yogi
    Posts: 1117
    calu on #46428

    Hello Ravi, the CSS rule worked very well, thanks a lot for your help.

    Regards
    Carsten

The topic ‘ [Resolved] remove settings from nav tab only’ is closed to new replies.

This topic is: resolved