Last active
June 3, 2021 05:59
-
-
Save wbcomdev/d1e2c94788312a9ee8d22c4ff1c4baa9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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