Created
March 6, 2013 05:10
-
-
Save benmay/5096884 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action ( 'admin_init', 'clean_up_admin_menu' ); | |
function clean_up_admin_menu () | |
{ | |
global $current_user, $menu; | |
$u = $current_user->user_login; | |
// If user isn't logged in. (fix for wp-admin/admin-ajax.php | |
if( ! $u ) | |
return; | |
// If it's admin or Alyte (admin) then leave all in tact. | |
if( $u == 'admin' || $u == 'alyte Ben' || $u == 'alyte Paul' ) | |
return; | |
$exclude = array(); | |
array_push( $exclude, 'Posts' ); | |
array_push( $exclude, 'Comments' ); | |
array_push( $exclude, 'Tools' ); | |
array_push( $exclude, 'Forms' ); | |
array_push( $exclude, 'Profile' ); | |
array_push( $exclude, 'Links' ); | |
array_push( $exclude, 'Plugins' ); | |
array_push( $exclude, 'Settings' ); | |
array_push( $exclude, 'VaultPress' ); | |
foreach($menu as $mId=>$menuArray){ | |
$tmp = explode(' ', $menuArray[0]); | |
if( in_array( $tmp[0] , $exclude ) ) | |
unset($menu[$mId]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment