Customers email orders to us in a shared mailbox so that anyone in the company can read the email and enter the order. However, what’s been happening a lot is that two people will get it at the same time (because outlook hasn’t marked it as “read” yet) and both of us will start entering it using the “Switch To” feature. Is it possible to set an alert on the backend “Users screen” that will alert you when someone else is already logged in as that user?
I quite like the idea of alerting a user when they attempt to switch to a user account into which somebody else is currently switched. I can see this being beneficial on sites that make heavy use of switching.
Rather than showing a message on the Users screen it should be shown at the point where the user clicks "Switch to", otherwise you'd still get a condition where two users load the Users screen in quick succession and neither are shown that another user has switched into any given account.
When a user switches, if another user is currently switched into that account then an "Are you sure?" message should be shown (probably via wp_die()) with the option to proceed or go back. The WordPress user session API can be used to check if there's another active session for the target user with a switched_from_id field present.
As requested by audbennett on https://wordpress.org/support/topic/show-in-use/
I quite like the idea of alerting a user when they attempt to switch to a user account into which somebody else is currently switched. I can see this being beneficial on sites that make heavy use of switching.
Rather than showing a message on the Users screen it should be shown at the point where the user clicks "Switch to", otherwise you'd still get a condition where two users load the Users screen in quick succession and neither are shown that another user has switched into any given account.
When a user switches, if another user is currently switched into that account then an "Are you sure?" message should be shown (probably via
wp_die()
) with the option to proceed or go back. The WordPress user session API can be used to check if there's another active session for the target user with aswitched_from_id
field present.