You are here

function masquerade_switch_back_page in Masquerade 7

Same name and namespace in other branches
  1. 6 masquerade.module \masquerade_switch_back_page()

Allows a user who is currently masquerading to become a new user.

2 string references to 'masquerade_switch_back_page'
masquerade_menu in ./masquerade.module
Implements hook_menu().
masquerade_translated_menu_link_alter in ./masquerade.module
Implements hook_translated_menu_link_alter().

File

./masquerade.module, line 874
The masquerade module allows administrators to masquerade as other user.

Code

function masquerade_switch_back_page() {
  if (isset($_GET['token']) && drupal_valid_token($_GET['token'], 'masquerade/unswitch')) {
    global $user;
    $olduser = $user;
    masquerade_switch_back();
    drupal_set_message(t('You are no longer masquerading as !masq_as and are now logged in as !user.', array(
      '!user' => theme('username', array(
        'account' => $user,
      )),
      '!masq_as' => theme('username', array(
        'account' => $olduser,
      )),
    )));
    drupal_goto($_SERVER['HTTP_REFERER']);
  }
  else {
    drupal_access_denied();
  }
}