I'm using masquerade in a setup where people can fill in webforms or if they don't a callcenter phones, interviews and fills in the webform on their behalf using masquerade. Works very well :)

In the webform I need to save the UID of original user who masqueraded as well. Webform has the functionality to use token to save various things into a hidden field, specifically any session variable. What would make more sense and be the better way of getting the two to talk, modifying webform to include tokens for $GLOBALS as well, or (what I think, which is why I'm posting here) this patch:

--- masquerade.module.orig 2006-11-20 11:38:41.000000000 +0200
+++ masquerade.module 2008-10-23 07:50:25.000000000 +0200
@@ -71,9 +71,11 @@
// using if so that we get unset rather than false if not masqing
if ($uid) {
$GLOBALS['masquerading'] = $uid;
+ $_SESSION['masquerading'] = $uid;
}
else{
$GLOBALS['masquerading'] = null;
+ $_SESSION['masquerading'] = null;
}
}

What is the advantage of using GLOBALS instead of SESSION here?

CommentFileSizeAuthor
#2 325019_globals_to_session.patch3.56 KBdeviantintegral
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deekayen’s picture

Status: Active » Needs review

Seems harmless enough, but I think I want Gurpartap to +1 this kind of functionality change before I'd commit it in case it's not really that harmless.

deviantintegral’s picture

Version: 5.x-1.3 » 6.x-1.x-dev
Status: Needs review » Fixed
FileSize
3.56 KB

This is a great idea - being able to use webform is really handy for support.

I've attached a patch which replaces all $GLOBALS with $_SESSION for the masquerade variable which I'll be committing in a moment.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.