Advertisements
Hi there,
If you want to hide menus from a specific user on wp-admin, you can use this hack.
I’ve used the example bellow combined with Role Manager Plugin to hide all the wp-admin menus, displaying just “Comments” for the user.
$user_id = get_current_user_id();
//echo "user:".$user_id;
if ($user_id == 2) {
function remove_menus () {
global $menu;
$restricted = array(__('Dashboard'), __('Agenda'), __('Downloads'), __('Galerias'), __('Depoimentos'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Plugins'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}
}
add_action('admin_menu', 'remove_menus');
}
Just put this code on functions.php.
Advertisements