Hello,
Is there a way I’m missing to restrict which users can be switched to? For example allow switching to users with an author role but not an editor role.
I’m hooking into switch_to_user, but at that time the switching has already happened. I can run checks at that point and force the user to logout, but I’d like to prevent the switching in the first place.
It would be great to have a hook like before_switch_to_user( $to_user_id, $from_user_id) somewhere near // Check authentication and // Check intent that would allow me to set my own logic and return a pass/fail.
