Can't switch users on some websites
-
Hello John. I’m having such a strange issue: when I click to switch to another user I get this message: “Could not switch users.”
As your plugin is using this string for 3 different error situations, I played with the text string to find out what cycle is where it is failing, and it happens here:
# Check authentication: if ( ! current_user_can( 'switch_to_user', $user_id ) ) { wp_die( esc_html__( 'Could not switch users.', 'user-switching' ) ); }
Obviously, I’m administrator or super-admin when in Multisite, but it looks like the plugin cannot determine that I have enough capabilities to switch_to_user.
It is happenning no matter if the destination user of the switch is another admin, a subscriber, an editor, etc.
I tested it in several versions and scenarios and see that this randomly happen on sites with WP 4.4/4.5/4.6 and in WP 4.6 Multisite.
No PHP errors are being logged, though.On WP 4.6 Multisite with PHP 5.6.24 it failed to switch users.
On WP 4.6 with PHP 5.6.24 without SSL it randomly failed (worked in some sites and don’t work in others).
On WP 4.6 with PHP 5.6.24 with SSL the plugin works ok.
On WP 4.6 with PHP 5.5.38 the plugin works ok.
On WP 4.6 with PHP 5.4.45 the plugin works ok.
On WP 4.4 with PHP 5.4.45 the plugin works ok.
On WP 4.0 with PHP 5.4.45 the plugin works ok.
On WP 3.8 with PHP 5.4.45 the plugin works ok.Please share any ideas or fixes or further tests I can take to discover the source of failure.
Best regards
- The topic ‘Can't switch users on some websites’ is closed to new replies.