• Resolved jonnyjaniero

    (@jonnyjaniero)


    Hey, thank you for your time involved in this plugin.

    Unsure if this is at all possible.
    So, I love the way that when switching to user I can then switch back from the use of the admin bar. Neat.
    I have a problem though. For my users on this particular site their admin bar is hidden via:

    
    if ( !current_user_can( 'administrator' ) ) {
       show_admin_bar(false);
    }
    

    Is their any conditional check to understand that I’m still an admin while switched to a user in the front-end. So I can still have the benefit of the admin bar.

    Does that makes sense?

    Thanks
    Jonny

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

    (@johnbillion)

    WordPress Core Developer

    If the admin bar is not shown, User Switching adds a Switch Back link to the Meta sidebar widget (if you’re using it), and also in the footer of your site. You might need to adjust your CSS if the link in the footer is being hidden.

    Thread Starter jonnyjaniero

    (@jonnyjaniero)

    Hi John,
    Thanks for getting back to me. I thought that may be the case.
    I was aware of the sidebar/footer thing. The approach would have been a neater flow for this particular site.

    All the best
    Jonny

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    If you want to code something yourself you can use the current_user_switched() function which returns the previous user object if the user has switched. You can then use user_switching::maybe_switch_url( $user ) to get the link to switch back.

    Thread Starter jonnyjaniero

    (@jonnyjaniero)

    Thank you for the follow up.
    Will take a look.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Admin bar to show when switching’ is closed to new replies.