Encoding error for switch_to_olduser nonce
-
First of all, awesome plugin! Couldn’t imagine developing without it anymore.
Just ran into a little issue locally with User Switching 0.7.1 and the latest WP 3.6 dev version. Basically, every time I wanted to switch back to the old user I’d get a nonce error (never happened with older WP versions).
A bit of digging turned up that the ampersand connecting the
_wpnoncearg to the rest of the url gets encoded by passing it throughadd_query_argagain when theredirect_toarg is added, so you end up with the html entity of the ampersand.I then modified the
switch_back_urlmethod so that the redirect arg gets passed as a parameter, like so:function switch_back_url( $redirect = false ) { $query_args = array( 'action' => 'switch_to_olduser' ); if( $redirect ) $query_args['redirect_to'] = urlencode( $redirect ); return wp_nonce_url( add_query_arg( $query_args, wp_login_url() ), 'switch_to_olduser' ); }This fixed things for me. I imagine that the
switch_off_urlmethod causes the same issue, but can’t test it, cause I’m using a custom admin theme with a modified admin bar.Be great if you could look into the problem and maybe get a fix out. Cheers!
~Boris
The topic ‘Encoding error for switch_to_olduser nonce’ is closed to new replies.