From time to time (and anytime after I run "drush cc all") my custom module with an access callback returns an 'access denied' error for Admins when they attempt to edit a user. I can solve this issue by disabling and re-enabling (any) module -- not just the one with the access callback code. If I remove this code, an admins ability to edit a user is fully and permanently restored. Here is the code in my custom module:
function cs_menu_alter(&$items) {
$items['user/%/edit']['access callback'] = 'cs_user_edit_access';
}
function cs_user_edit_access() {
global $user;
if (!user_has_role(3, $user) || !user_has_role(4, $user)) {
return FALSE;
}
else {
return TRUE;
}
}
I don't know why this code would suddenly stop working, but I don't really want to lose the functionality that this custom code supplies (most of the time).
%user
which should be able to be passed to the function without doing global user.