• Resolved Ellis Benus

    (@glaxton)


    Is it possible to create a “Switch To” link in a location other than the users.php page?

    I would like to use this capability with a custom plugin I’ve developed to put a button for someone to sign in as the user a custom post type is tied to.

    I cannot call the action_personal_options() function directly and it seems I cannot create a new instance of the class user_switching either.

    Any help is appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Yeah you can do this with the following code:

    $link = user_switching::maybe_switch_url( $user ) where $user is an instance of WP_User.

    It’ll return the URL for switching to the user if the current user can switch to the given user, or boolean false if not.

    Thread Starter Ellis Benus

    (@glaxton)

    Epic! Thank you so much! Could you possibly add this to the documentation of the plugin b/c I searched and counldn’t find anything about it.

    Great plugin. 5 stars. And thank you so much for your rapid response!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Include User Switching Link Outside users.php’ is closed to new replies.