Advertisement
miriamdepaula

WordPress: Limitando acesso aos menus do painel

Aug 26th, 2011
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. function remove_menus()
  2. {
  3.     global $menu;
  4.     global $current_user;
  5.     get_currentuserinfo();
  6.  
  7.     if($current_user->user_login == 'mariazinha')
  8.     {
  9.         $restricted = array(//__('Posts'),
  10.                             //__('Media'),
  11.                             //__('Links'),
  12.                             //__('Pages'),
  13.                             //__('Comments'),
  14.                             __('Appearance'),
  15.                             __('Plugins'),
  16.                             //__('Users'),
  17.                             __('Tools'),
  18.                             __('Settings')
  19.         );
  20.         end ($menu);
  21.         while (prev($menu)){
  22.             $value = explode(' ',$menu[key($menu)][0]);
  23.             if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
  24.         }// end while
  25.  
  26.     }// end if
  27.    
  28. }
  29. add_action('admin_menu', 'remove_menus');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement