Skip to:
Content
Pages
Categories
Search
Top
Bottom

Removing delete-group from group admins in 2.4+


  • aapi001
    Participant

    @aapi001

    Hello I had a question in continuation of the topic below ref removing the delete-group from group admins using the code provided below :
    https://buddypress.org/support/topic/how-to-remove-tabs-from-group-admin-nav-2/#post-261003

    function turker_remove_group_admin_tab() {
    	if ( ! bp_is_group() || ! ( bp_is_current_action( 'admin' ) && bp_action_variable( 0 ) ) || is_super_admin() ) {
    		return;
    	}
    
    	// Add the admin subnav slug you want to hide in the
    	// following array
    	$hide_tabs = array(
    		'group-avatar' => 1,
    		'delete-group' => 1,
    	);
    
    	$parent_nav_slug = bp_get_current_group_slug() . '_manage';
    
    	// Remove the nav items
    	foreach ( array_keys( $hide_tabs ) as $tab ) {
    		bp_core_remove_subnav_item( $parent_nav_slug, $tab );
    	}
    
    	// You may want to be sure the user can't access
    	if ( ! empty( $hide_tabs[ bp_action_variable( 0 ) ] ) ) {
    		bp_core_add_message( 'Sorry buddy, but this part is restricted to super admins!', 'error' );
    		bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) );
    	}
    }

    Dan writes:

    Get Ready! 2.4.0 will introduce important changes in Groups homes

    “The function is still working, but not completely (tabs aren’t hidden). You probably need to complete it with $component (read above document)”

    This code was written circa 2.2. Im not sure where/how to add the $component to get the code to work. Any assistance is appreciated thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar