BuddyDev

Search

How to hide group settings tab?

  • Participant
    Level: Initiated
    Posts: 1
    Matthew Webb on #24538

    All our groups will be set to private and any member can invite new members. The group settings tab is now useless, but I cannot figure out how to remove it from the group creation process.We have the BuddyPress Group Tabs Creator Pro plugin, and I thought it could override the default tabs, but I can’t seem to make it work. Can I do this with the plugin or is it even possible with in-house code?

  • Keymaster
    (BuddyDev Team)
    Posts: 24501
    Brajesh Singh on #24539

    Hi Matthew,
    Welcome to BuddyDev forums.

    The tabs creators pro allows you to add any tab/sub tab. It allows removing top level tabs from group but not from group creation.

    You can use the following code to remove th settings tab from group creation.

    
    /**
     * Remove group settings from group creation.
     */
    add_filter( 'groups_create_group_steps', function ( $steps ) {
    	unset( $steps['group-settings'] );
    
    	return $steps;
    } );
    
    

    Hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    Matthew Webb on #24545

    Thank you, that got me almost to where I need.

    That removed it from the group creation phase. Any idea how I can remove the settings tab from the group manage sub-nav.

  • Keymaster
    (BuddyDev Team)
    Posts: 24501
    Brajesh Singh on #24555

    Hi Matthew,
    Please add the following lines too

    
    
    /**
     * Remove group admin/settings sub nav.
     */
    function buddydev_remove_group_admin_settings() {
    
    	if ( ! bp_is_group() ) {
    		return;
    	}
    
    	bp_core_remove_subnav_item( groups_get_current_group()->slug . '_manage', 'group-settings', 'groups' );
    
    	// reattach screen function to avoid 404.
    	add_action( 'bp_screens', 'groups_screen_group_admin', 3 );
    }
    
    add_action( 'bp_template_redirect', 'buddydev_remove_group_admin_settings', 1 );
    

    That will remove the settings from manage too.

    Hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 2
    George on #53203

    Hello, that was helpful, thank you!

    Is there a way to do the same for the bbPress “Forum” tab? I have looked everywhere but can’t get it to work!

  • Keymaster
    (BuddyDev Team)
    Posts: 24501
    Brajesh Singh on #53208

    Hi George,
    Thank you.

    Do you want to remove it from group creation?

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 2
    George on #53209

    Hi Brajesh.

    Yeah, I want to remove it from the group creation and also from the Manage settings, just like how you showed with the group settings.

    Doing this is not working:

    add_filter( 'groups_create_group_steps', function ( $steps ) {
    	unset( $steps['forum'] );
    	return $steps;
    } );
  • Keymaster
    (BuddyDev Team)
    Posts: 24501
    Brajesh Singh on #53210

    Hi George,
    BuddyPress extensions add their nav very differently(directly accessing globala nd won’t be available when teh above filter is used).

    Here is a temporary solution(It only hides nav links not the actual handler attached with the forum).

    
    add_action( 'bp_actions', function () {
    
    	$bp = buddypress();
    
    	if ( isset( $bp->groups->group_creation_steps ) ) {
    		unset( $bp->groups->group_creation_steps['forum'] );
    	}
    
    }, 10 );
    
    

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved