Closed (fixed)
Project:
Masquerade
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 May 2006 at 10:48 UTC
Updated:
7 Jun 2014 at 20:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mj2308 commentedI have the same problem as well ... =(
Comment #2
smilodon commentedI gave up with OG, fortunately it was not so critical on my site. Very many problems solved, less errors with every other module.
Comment #3
ec commentedI also have the same problem here with drupal 4.7.0 and latest og release ! regards, eric.
Comment #4
starbow commentedHmm, seems like $user->masquerade is getting unset somewhere.
It's a nasty hack, but you can work around this by changing the line:
$items[] = array('path' => 'masquerade/unswitch',
'title' => t('switch back'),
'callback' => 'masquerade_switch_back',
'access' => $user->masquerading,
'type' => MENU_NORMAL_ITEM);
to:
$masquerading = db_result(db_query("SELECT uid_from FROM {masquerade} WHERE sid = '%s'\
AND uid_as = %d", session_id(), $user->uid));
$items[] = array('path' => 'masquerade/unswitch',
'title' => t('switch back'),
'callback' => 'masquerade_switch_back',
'access' => $masquerading,
'type' => MENU_NORMAL_ITEM);
Comment #5
yngens commentedHi,
I also have this problem. Tried given replacement of the code, but unfortunately it did not help, I still can not change back to admin. Any progress on this issue?
Comment #6
cooperaj commentedI am encountering the same issue.
and the above code does not fix.
Regards
Adam
Comment #7
cooperaj commentedFound that the menu cache was not being cleared for the new user when switching. Meaning that although starbows fix was working the menu displayed was a cached version, hence no switch back option. To fix
Add:
Just above:
In:
Making:
Comment #8
ec commentedHy, I tried both fix but still fall on the same issue ! Any idea ? regards, eric.
Comment #9
jhm commentedit doesn't work with OG because that module calls the user_load function and thus overrides the state of masquerading the masquerade module is trying to track in the global $user structure.
I am looking into a patch for the masquerade module, so it will not use a global structure that could be overritten to track its state.
see: http://drupal.org/node/71907
Comment #10
jhm commentedI created a new global variable called masquerading and set its value to
null. In theinithook of masquerade I track the masqueraded uid in this global variable.This being a quick hack, I did not bother removing/changing the current global $user references.
This is what the new masquerade_init looks like:
Now we just need to modify the
menuhook to retrieve the global value:that works on my 4.7.2 drupal installation with the latest og module.
Comment #11
merlinofchaos commentedCan you submit this in patch form?
Comment #12
jhm commentedhere is a patch file
Comment #13
Steve Dondley commentedI tried the patch but it doesn't to seem to have any affect at all.
Comment #14
Steve Dondley commentedOK, here's a different version of jhm's patch. The switch back link now shows for me. I did away with using $user->masquerade and just used the $GLOBALS['masquerade'] variable. Maybe this isn't the best way but it works.
Comment #15
Steve Dondley commentedHmm...somehow some tabs snuck into the patch. Here's a version of the same patch with them removed.
Comment #16
Steve Dondley commentedSet to review.
Comment #17
Steve Dondley commentedPatch applied, committed to head and drupal-4-7 branch
Comment #18
(not verified) commented