Support » Plugin: User Switching » Allow other roles to Switch User

  • Resolved Howdy_McGee

    (@howdy_mcgee)


    Hello,

    Are there any hooks I could use or capabilities I could add to allow users of other specific roles the “Switch User” functionality? It looks like right now, only the administrator has this functionality and I would like to extend it to Shop Managers.

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

    (@johnbillion)

    WordPress Core Developer

    Yep this is possible, take a look in the FAQ.

    I saw the information in FAQs, but it’s unclear how to add that setting. I do not see the ability add switch user to someone’s role. I am using the ‘Shop Manager’ role as well as Capabilities Pro and have it set to all the the ‘Shop Manager’ role to ‘list’ and ‘edit’ users.

    Can you please clarify? Thanks

    • This reply was modified 2 months, 1 week ago by 1099greg.
    Thread Starter Howdy_McGee

    (@howdy_mcgee)

    Thanks, John!

    @1099greg What I ended up doing was installing the User Role Editor plugin activating it, and did the following:

    1) Navigate to Users -> User Role Editor in the left-hand admin navigation.

    2) Using the select box at the top of the User Role Editor screen, I selected the “Shop Manager” role from the list.

    Selecting the Shop Manager role will bring up all available capabilities for that role with their allowed capabilities checked.

    3a) Search the list for the switch_users capability. If you find the capability, check it, and click the “Update” button on the right-hand side. Verify that the functionality works by logged into a user with that role.

    3b) If the capability is not in the list (which was my case), you can add the capability by clicking the “Add Capability” button on the right-hand side. This will display a modal window where you can paste switch_users (careful on spelling and ensuring no extra spaces) and click “Add Capability”. This will add the capability to the list, and you can read over point 3a above.

    – – – – – – – – – –

    Using the plugin above, you can assign the capability if it exists or add it if it does not and assign it to your specified role. Once the capability has been added, you can remove the User User Role Editor plugin without consequence. Hopefully, the above instructions help!

    Thank you @howdy_mcgee – that sounded like it would be the solution, but it did not work.

    I did have to add the switch user capability, which seemed odd, but now I’m stepping through disabling other plugins to see if there’s a conflict somewhere else.

    Thanks again!

    • This reply was modified 2 months, 1 week ago by 1099greg.

    So with a little further investigation, I have found in the WooCommerce core short codes ! current_user_can('pay_for_order') is what’s generating the error.

    With some digging I found this solution – which worked without a plugin (only modifying which user role it got applied to):

    https://stackoverflow.com/questions/53506914/remove-customer-payment-page-restrictions-for-admins-in-woocommerce-pay-for-o

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Allow other roles to Switch User’ is closed to new replies.