adminimize small bug / with my fix for wordpress MU
-
in the function _mw_adminimize_set_menu_option()
I’ve replaced
// set admin-menu
foreach ($user_roles as $role) {if($role == $role[0]){
if ( current_user_can($role) ) {
$mw_adminimize_menu = $disabled_menu_[$role];
$mw_adminimize_submenu = $disabled_submenu_[$role];
}
} elseif ( current_user_can($role) ) {
$mw_adminimize_menu = $disabled_menu_[$role];
$mw_adminimize_submenu = $disabled_submenu_[$role];
}
}by
// set admin-menu
foreach ($user_roles as $role) {
$user = wp_get_current_user();
if(in_array($role,$user->roles)){
if ( current_user_can($role) ) {
$mw_adminimize_menu = $disabled_menu_[$role];
$mw_adminimize_submenu = $disabled_submenu_[$role];
}
}
}As you can see my version checks if the current user has that role assigned to them before assigning it. The old code would always return true for Current user can when logged in as a site admin, therefore random permissions would be applied based on the order of the array.
thank you for the great plugin
- The topic ‘adminimize small bug / with my fix for wordpress MU’ is closed to new replies.