Menu's and capability's problem
-
Hi,
I have WP 3.5 with 3 roles: Suscriptor, Administrator, Editor
I want to hide ALL menu of subscriber2 (Settings, Send, User, Manage) for user role ‘Suscriptor’, and I want to enable these 4 menus only for user role ‘Administrator’ and ‘Editor’.I made these code in ‘susbriber2.php’
function s2_admin_changes( $capability, $menu ) { global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); //MENU PREFERENCIAS PERSONALES if ( $menu == 'user' ) { if($user_role=='Administrator' || $user_role=='Editor'){ return 'read'; } } if ( $menu == 'manage' ) { if($user_role=='Administrator' || $user_role=='Editor'){ return 'read'; } } if ( $menu == 'settings' ) { if($user_role=='Administrator' || $user_role=='Editor'){ return 'read'; } } //MENU ENVIAR CORREO PRUEBA if ( $menu == 'send' ) { if($user_role=='Administrator' || $user_role=='Editor'){ return 'read'; } } return $capability; } add_filter('s2_capability', 's2_admin_changes', 10, 2);
Works but ‘Subcriptor’ can view menu ‘user’ (User preferences). I know about WordPress and roles & capabilitys, but I want to ask that it is possible to change capability (new capabilty that I create) for view menu ‘user’ in subscriber2? Or there is any way easy to hide these menu ‘user’ for my role ‘Suscriptor’ ?
Thanks in advance!!
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Menu's and capability's problem’ is closed to new replies.