function userprotect_user_delete_access in User protect 6
Access callback for user delete pages.
This replaces the logic from user.module.
Parameters
$account: An object representing the user to be deleted.
1 string reference to 'userprotect_user_delete_access'
- userprotect_menu_alter in ./
userprotect.module - Implementation of hook_menu_alter().
File
- ./
userprotect.module, line 435
Code
function userprotect_user_delete_access($account) {
if (user_access('administer users')) {
// Check to see if the user's roles are protecting deletion, or the user
// account itself is protected.
if (!userprotect_check_bypass('up_delete') && userprotect_get_user_protection($account, 'up_delete')) {
// If so, and we're at /user/X/delete, set a message.
if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'delete') {
drupal_set_message(t('%user is currently being protected from deletion.', array(
'%user' => $account->name,
)), 'error');
}
return FALSE;
}
return TRUE;
}
else {
return FALSE;
}
}