function sms_receive_switch_user in SMS Framework 5
This is verbatim from mailhandler_switch_user()
Switch from original user to submission user and back.
Note: You first need to run sms_receive_switch_user without argument to store the current user. Call sms_receive_switch_user without argument to set the user back to the original user.
Parameters
$uid The user ID to switch to:
1 call to sms_receive_switch_user()
- sms_receive_receive in modules/
sms_receive/ sms_receive.module
File
- modules/
sms_receive/ sms_receive.module, line 278
Code
function sms_receive_switch_user($uid = NULL) {
global $user;
static $orig_user = array();
if (isset($uid)) {
$user = user_load(array(
'uid' => $uid,
));
}
else {
if (count($orig_user)) {
$user = array_shift($orig_user);
array_unshift($orig_user, $user);
}
else {
$orig_user[] = $user;
}
}
}