Hide media, comments and tools from users

This commit is contained in:
Brian Miyaji
2014-05-31 10:29:46 +10:00
parent e18c222cbc
commit 2d02d42f8f

View File

@@ -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;
} }
/** /**