How to remove tabs from group admin nav
-
Hi,
I want to remove some group admin tabs(Details, Settings… Delete) from navigation which is displayed by bp_group_admin_tabs function in groups/single/admin.php file.
I tried add_action(‘groups_admin_tabs’… which triggered only for current admin tab.
I used var_dump($bp) by hooking bp_init, bp_ready, wp_head etc but i cant find anything related to admin tab content e.g. Nothing found about “Delete”Thanks,
Turker.
-
Thanks for your quick reply but i want to remove some default BP tabs and also some plugin tabs added with group extension api. I dont want add new one or edit nav title or content.
I just need a hook to filter displayed tabs or a way to gather group admin tabs from global $bp variable or a way to find & unregister currently registered group extension(which seems not possible because it’s registered by an anonymous function).
i want to remove some default BP tabs
Re removing the Manage > Delete tab…
You’re referring to the anon function in bp-groups-classes.php ?
add_action( 'groups_admin_tabs', create_function( '$current, $group_slug', etc...
I agree that it’s unclear.
I think that if that function added a css id to the li tag, then we should be able to use the filter in bp_get_options_nav in bp-core-template.
If this makes sense, and you haven’t found a workaround, please open a ticket on trac.Yes, i was referring that part. I cant use remove action because of anon function usage.
I’ll try to remove by add filter to bp_get_options_nav_{css_id}.
Thanks.
I’ll try to remove by add filter to bp_get_options_nav_{css_id}
If you can figure out what that filter hook is, please share it here. Thanks.
.Hi @danbp asked me about this.. So here’s a way to hide the tabs
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() ) ); } } add_action( 'bp_actions', 'turker_remove_group_admin_tab', 9 );
Oopsy. I just realized you’ll need to wait till BuddyPress 2.2 to use this snippet.
See my post here https://bpdevel.wordpress.com/2014/11/08/the-way-the-groups-manage-subnav-is-generated-has-been-improved/
Merci @imath
A provisory solution could to use a template overload of groups/single/admin.php by removing the unwanted items from this file ?
- The topic ‘How to remove tabs from group admin nav’ is closed to new replies.