Tag Archives: users

WordPress Plugin: User Switching

Latest version: 0.6.3- Released September 27th, 2012:
  • Lithuanian translation by Tommixoft.

Description

This plugin allows you to quickly swap between user accounts in WordPress at the click of a button. You'll be instantly logged out and logged in as your desired user. This is handy for test environments where you regularly log out and in between different accounts, or for adminstrators of sites who need to switch between multiple accounts.

Features

  • Switch users: Instantly switch to any user account from the Users screen.
  • Switch back: Instantly switch back to your originating account.
  • Switch off: Log out of your account but retain the ability to instantly switch back in again.
  • It's completely secure (see the Security section below).
  • Compatible with WordPress, WordPress Multisite, BuddyPress and WordPress MU.

Security

  • Only users with the ability to edit other users can switch user accounts (by default this is only Administrators). Lower level users cannot switch accounts.
  • User switching is protected with the WordPress nonce security system, meaning only those who are allowed to switch users can switch.
  • Full support for administration over SSL (if applicable).
  • Passwords are not (and cannot be) revealed.

Translations Included

  • Chinese Simplified by Tunghsiao Liu (Sparanoid)
  • German by Ralph Stenzel
  • Farsi (Persian) by Amin Ab
  • Slovak by Max Samael
  • Polish by Bartosz Arendt
  • Lithuanian by Tommixoft

Screenshots

  1. user-switching screenshot 1

    The Switch To link on the Users screen

  2. user-switching screenshot 2

    The Switch To link on a user's profile

Installation

You can install this plugin directly from your WordPress dashboard:

  1. Go to the Plugins menu and click Add New.
  2. Search for User Switching.
  3. Click Install Now next to the User Switching plugin.
  4. Activate the plugin.

Alternatively, see the guide to Manually Installing Plugins.

Usage

Visit the Users menu in WordPress and you'll see a Switch To link next to each user. Clicking this will switch you into that user account. Once switched, you can switch back to your originating account via the Switch back link on each dashboard screen.

See the FAQ for information about the Switch Off feature.

Todo list

  • A custom capability (eg. ‘switch_users’) which can be granted to lower level users so they can switch accounts. Done!
  • Support for WordPress 2.5.x/2.6.x if the demand is there. This certainly isn’t going to happen.
  • Some way of switching back to the administrator account after switching to a lower level account (will require a cookie-based remembering system which doesn’t compromise security).
    Done!
  • A persistent notification in the admin area reminding you that this is an account you switched to and not your account (also reliant on solution above). Done!

FAQ

What does "Switch off" mean?

Switching off logs you out of your account but retains your current user ID in a cookie so you can switch straight back (ie. log straight back in) without having to log in with your username and password. It's akin to switching to no user, and being able to switch back.

The Switch Off link can be found in your profile menu in the WordPress toolbar. Once you've switched off you'll see a Switch back link in the footer of your site.

Does this plugin work with WordPress Multisite?

Yes, and you'll also be able to switch users from the Users screen in Network Admin.

Does this plugin work with BuddyPress?

Yes, and you'll also be able to switch users from the Members screens.

Does this plugin work with WordPress MU?

Yes, but you should really update to Multisite.

Does this work as a mu-plugin?

Yes, but you'll need to install user-switching.php into the root of your mu-plugins directory, not in the user-switching subdirectory. This is a restriction of WordPress.

What capability does a user need in order to switch accounts?

A user needs the edit_users capability in order to switch user accounts. By default only Administrators have this capability, and with Multisite enabled only Super Admins have this capability.

Are any hooks called when users switch accounts?

Yes. When a user switches to another account, the switch_to_user hook is called with the new and old user IDs passed as parameters.

When a user switches back to their original account, the switch_back_user hook is called with the new (original) and old user IDs passed as parameters.

When a user switches off, the switch_off_user hook is called with the old user ID as a parameter.

Download

This plugin requires WordPress version 2.7 or later, or WPMU version 2.7 or later.

Version 0.6.3 ZIP file from downloads.wordpress.org

Any comments, questions, queries, suggestions, complaints, etc, please leave a comment!