Brief Thoughts on a Ten Year Old WordPress Plugin

Today my User Switching plugin for WordPress turns ten years old.

Its active user base passed 100,000 last year which I think classifies it as moderately popular. For a plugin that’s primarily developer-oriented that’s a good number.

User Switching is a very tightly focused plugin. It allows users to:

  • Switch to other users
  • Switch back again
  • Switch off (temporarily log out)

I consider the plugin was feature complete just a few weeks after the first version. Version 0.2 in 2009 added the ability to switch back to the user’s previous account, and with that addition the plugin did all that I wanted it to do. So what’s changed over the last ten years?

Actions and Filters

Several hooks have been added to User Switching so other developers can trigger actions when a user switches between accounts. The hooks were added in version 0.6 in 2012 and are documented here in the FAQ.

Stacked Switching

If you switch to another user that has the ability to manage users on the site (for example by switching to another Administrator), you can subsequently switch from that account into another. You can then switch back to the administrator you first switched to, and switch into another account again, or switch back to your original account to complete the switching process.

Sure this workflow isn’t a particularly common one, but it’s been fully supported by User Switching since version 0.8 was released in 2013.

Session Re-Use

Expirable user sessions were implemented in WordPress 4.0 in 2014. When switching between users with User Switching, this meant that an extra user session was created every time you switched, and also every time you switched back.

It took me three attempts, four years, and a test-driven development approach to finally implement the retention, reuse, and destruction of user sessions when switching (to avoid extra sessions being created every single time you switch or switch back), and this was finally added in version 1.4 in 2018.

Not Much Else

That’s about it. All the other changes that have been made to User Switching over the years have been relatively minor tweaks and support for changes in or additions to WordPress core, plus a bit of extended support for Multisite, BuddyPress, and bbPress to ensure the process of switching between users is as seamless as possible.

What’s Next

I’m wary of calling anything “complete’, but User Switching is about as close to complete as I’ll ever get with any piece of code.

That said, I’m waiting for the release of WooCommerce 3.6 which will allow me to release an update to User Switching so it will more gracefully handle the shopping basket contents when switching between users. Supporting third party plugins greatly increases the maintenance burden, but WooCommerce is sufficiently popular (and this bug is sufficiently annoying) for me to decide to address it.

Here’s to ten more years of WordPress plugins! (Query Monitor also turns ten later this year.)

6 replies on “Brief Thoughts on a Ten Year Old WordPress Plugin”

  1. User Switching saved me hours and hours of time debugging issues reported by others. Thanks for a great plugin!

  2. Thanks for sharing your plugin, John. I’ve used it for many years and it has become an essential support tool with having WooCommerce customers as users on my sites. I use it enough that I added a “switch to” link on my WooCommerce order screen.

  3. This, and Query Monitor are probably the first 2 plugins I install when developing a new WordPress site. Thank you so much for your hard work.

  4. John, this plugin is exactly what I needed but nowhere – nowhere on WordPress does it say how to use it. Your plugin is activated and I go to User accounts but that link “Switch User” link doesn’t show up on my screen. Once I go into my User Account list, how do I switch to another user? Thanks.

    1. Take a look through the plugin description, screenshots, and FAQs. If the “Switch To” links aren’t showing up anywhere then there may be a conflicting plugin on your site, or something is messing up the user account permissions on your site. If you can’t figure it out, feel free to post a support thread on the plugin support forums.

Comments are closed.