Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Entering a username on the "Enter the users this user is able to masquerade as:" field on a profile is not allowing a user to masquerade as set users. It seems that is not retaining the usernames entered.
As I understand it, this field should work without the need to allow "Masquerade as any user".
Any ideas?
Comments
Comment #1
offback CreditAttribution: offback commentedAs I'm pretty new to drupal, I'm not sure if this is the right thing to do but I fixed this on my site by moving the code in the masquerade.module file the masquerade_user() function in the case update part of the code to the case submit part of the code. It seemed like there are times when masquerade_user() case update was called when the form data containing the users "masquerade as fields" has not been loaded in those cases the database field was cleared.
This may break other things but seems to be working for me.
case 'submit':
$old_session_id = session_id();
/* code move from case update to case submit */
if ($category == 'account') {
$users = drupal_explode_tags($edit['masquerade_users']);
db_query("DELETE FROM {masquerade_users} WHERE uid_from = %d", $edit_user->uid);
foreach ($users as $user) {
$u = user_load(array('name' => $user));
db_query("INSERT INTO {masquerade_users} VALUES (%d, %d)", $edit_user->uid, $u->uid);
}
$edit['masquerade_users'] = NULL;
}
/* end code moved */
break;
case 'update':
break;
Comment #2
boftx CreditAttribution: boftx commentedI tried this, and it does keep existing assignments in place.
Howerver ...
It prevents new ones from being assigned.
Comment #3
apadernoI am closing this bug report, as Drupal 6 is no longer supported. Please re-open it if the issue is still relevant for the Drupal 7 or 8 version of the module.