Hide media, comments and tools from users
This commit is contained in:
@@ -183,7 +183,7 @@ class SP_Admin_Menus {
|
|||||||
* Clean the SP menu items in admin.
|
* Clean the SP menu items in admin.
|
||||||
*/
|
*/
|
||||||
public function menu_clean() {
|
public function menu_clean() {
|
||||||
global $menu, $submenu;
|
global $menu, $submenu, $current_user;
|
||||||
|
|
||||||
// Find where our separator is in the menu
|
// Find where our separator is in the menu
|
||||||
foreach( $menu as $key => $data ):
|
foreach( $menu as $key => $data ):
|
||||||
@@ -219,6 +219,15 @@ class SP_Admin_Menus {
|
|||||||
$submenu['edit.php?post_type=sp_staff'] = array_filter( $submenu['edit.php?post_type=sp_staff'], array( $this, 'remove_leagues' ) );
|
$submenu['edit.php?post_type=sp_staff'] = array_filter( $submenu['edit.php?post_type=sp_staff'], array( $this, 'remove_leagues' ) );
|
||||||
$submenu['edit.php?post_type=sp_staff'] = array_filter( $submenu['edit.php?post_type=sp_staff'], array( $this, 'remove_seasons' ) );
|
$submenu['edit.php?post_type=sp_staff'] = array_filter( $submenu['edit.php?post_type=sp_staff'], array( $this, 'remove_seasons' ) );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
$user_roles = $current_user->roles;
|
||||||
|
$user_role = array_shift($user_roles);
|
||||||
|
|
||||||
|
if ( in_array( $user_role, array( 'sp_player', 'sp_staff', 'sp_event_manager', 'sp_team_manager' ) ) ):
|
||||||
|
remove_menu_page( 'upload.php' );
|
||||||
|
remove_menu_page( 'edit-comments.php' );
|
||||||
|
remove_menu_page( 'tools.php' );
|
||||||
|
endif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user