Skip to content

Instantly share code, notes, and snippets.

@wbcomdev
Last active June 3, 2021 05:59
Show Gist options
  • Select an option

  • Save wbcomdev/d1e2c94788312a9ee8d22c4ff1c4baa9 to your computer and use it in GitHub Desktop.

Select an option

Save wbcomdev/d1e2c94788312a9ee8d22c4ff1c4baa9 to your computer and use it in GitHub Desktop.
<?php
/**
* Wbcom hide admin products tab to a certain groups.
*
* @return void
*/
function wbcom_remove_admin_products_tab_from_group_tabs() {
global $bp;
$user_id = get_current_user_id();
$group_id = $bp->groups->current_group->id;
$user_admin = groups_is_user_admin( $user_id, $group_id );
if ( $user_admin && 27 === $group_id || 18 === $group_id ) {
remove_action( 'bp_init', 'wbcom_add_admin_product_nav_at_single_group_page' );
}
}
add_action( 'bp_setup_nav', 'wbcom_remove_admin_products_tab_from_group_tabs' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment