You are here

function subuser_switch_user in Subuser 6

Same name and namespace in other branches
  1. 8 switch/subuser_switch.module \subuser_switch_user()
  2. 7.2 switch/subuser_switch.module \subuser_switch_user()

Switch from a parent user to a subuser (or child user).

Parameters

$uid The user id to switch to.:

1 string reference to 'subuser_switch_user'
subuser_menu in ./subuser.module
Implementation of hook_menu().

File

./subuser.module, line 249
Allows users of a particular role to create sub user account in another role.

Code

function subuser_switch_user($uid) {
  global $user;
  if ($uid) {
    $_SESSION['subuser_uid'] = isset($_SESSION['subuser_uid']) && $uid == $_SESSION['subuser_uid'] ? NULL : $user->uid;
    $user = user_load($uid);
  }
  drupal_goto('user/' . $uid);
}