Closed (won't fix)
Project:
User protect
Version:
6.x-1.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Nov 2009 at 18:26 UTC
Updated:
18 Nov 2009 at 18:51 UTC
Looks like both userprotect and user_delete want to menu_alter "user/%user/delete".
User_delete is a module which exposes a permission allowing certain roles to delete their own account, along with some options such as to back up their data. The problem is that when userprotect's menu_alter hook gets called after user_delete's, it will overwrite the access callback with it's own, meaning that user_delete's functionality is crippled and user's with the requisite permission cannot delete their own account.
Here's userprotect's access callback:
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;
}
}
And here's user_delete's:
function user_delete_access($account) {
global $user;
return (user_access('administer users') || (user_access('delete own account') && $account->uid == $user->uid));
}
Comments
Comment #1
hunmonk commentedsorry, this is a limitation in Drupal's menu access system, there's nothing i can really do about it. only one menu access function is permitted per callback. your only option that i can think of is to hack the menu access callback in one of the modules.