function masquerade_init in Masquerade 5
Same name and namespace in other branches
- 6 masquerade.module \masquerade_init()
- 7 masquerade.module \masquerade_init()
Implementation of hook_init().
File
- ./
masquerade.module, line 31 - masquerade.module
Code
function masquerade_init() {
global $user;
// load from table uid + session id
$uid = db_result(db_query("SELECT uid_from FROM {masquerade} WHERE sid = '%s' AND uid_as = %d", session_id(), $user->uid));
// using if so that we get unset rather than false if not masqing
if ($uid) {
$GLOBALS['masquerading'] = $uid;
}
else {
$GLOBALS['masquerading'] = null;
}
}