Community Documentation

Masquerade - switch to another user then switch back

Last updated October 3, 2012. Created by peterx on October 2, 2012.
Log in to edit this page.

The Masquerade module allows users to temporarily switch to another user account. It keeps a record of the original user account, so users can easily switch back to the previous account.

I started this because I use Masquerade and need to document some usage somewhere. I might as well do it here and let you read it.

Anyone can edit this page and add child pages. When you find out something new, add it here.

Permissions

Masquerade as user: Masquerade as another user.
Masquerade as admin: Masquerade as the site admin (UID 1).
Administer Masquerade: Perform administration tasks and configure the Masquerade module.

masquerade_init()

Put the user id in a session variable if found in the {masquerade} table. This indicates the user is masquerading.
$_SESSION['masquerading'] = $uid;

masquerade_cron()

Remove entries from the {masquerade} table when the session is gone.

masquerade_menu()

Entries for URLs masquerade/switch/?? where ?? is a test user, masquerade/switch/%, masquerade/unswitch, masquerade/autocomplete, masquerade/autocomplete-user, and admin/config/people/masquerade.

README.txt

= Masquerade =

The Masquerade module allows users to temporarily switch to another user
account. It keeps a record of the original user account, so users can easily
switch back to the previous account.

== Installation and Configuration ==

To install the Masquerade module, extract the module to your modules folder,
such as sites/all/modules. After enabling the module, it can be configured
under Administer > Configuration > People > Masquerade. To enable users to
masquerade, assign the appropriate "masquerade module" permissions to the roles
available on your site. For example:

* To allow members of the 'customer support' role to masquerade as any
non-admin user, add the 'masquerade as user' permission to the role. In the
Masquerade configuration, set 'administrator' as an administrator role
to prevent customer support users from masquerading as those users.

* To allow members of the 'tech support' role to masquerade as 'administrator', add the 'masquerade as admin' permission to the role. Then,
in the Masquerade configuration, set 'administrator' as an
administrator role.

== Quick Switch Menu ==

By default, when a user is selected for the 'Menu Quick Switch user', the Masquerade module adds two menu items to the 'Navigation' menu:

* Masquerade as 'the user selected': When clicked, the user can quick switch to the user selected.

* Switch back: This menu item appears while masquerading so that you can switch back to your original user.

== Help and Support ==

This module was developed by a number of contributors. For more information
about this module, see:

Project Page: http://drupal.org/project/masquerade
Issue Queue: http://drupal.org/project/issues/masquerade

Page status

About this page

Drupal version
Drupal 7.x
Audience
Programmers, Site administrators, Site builders
Level
Intermediate
Keywords
User Management

Site Building Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here