6

I don't particularly want to enable Devel on my production environment to gain the Switch Users block. Is there a way to switch users without any additional php code?

6

drush user-login allows you to easily log in as any user.

Compared to a module that "emulates" a different users session:

The disadvantage is that this will require a separate session, often that just means a new browser (window).

The advantage is that you know for certain that you see what the user sees.

This will not explicitly change the password for the user but you will be able to change the password of the user once you login.

Display a one time login link for the given user account (defaults to uid 1).

Example:

"drush user-login ryan"

Displays a one-time login link for the user ryan.

Aliases: uli

| improve this answer | |
  • Oh yes, I totally forgot about this. Never thought to use it for switching user, thanks! – DanH Apr 17 '12 at 3:44
  • Note that if you are already logged in, you'll have to logout before using the one-time-login link. So it's not as convenient as Masquerade or Role Switcher. Or, you could use a different browser. – Dan Halbert Apr 17 '12 at 12:13
  • Good point. Added that. – Letharion Apr 17 '12 at 12:25
  • This will reset the password for the user right? – anoopjohn Apr 21 at 17:11
  • 1
    @anoopjohn No, it will let you do so, but it won't happen on it's own. – Letharion Apr 23 at 8:29
8

There's Masquerade.

Masquerade adds some items to the Navigation menu to allow quick switching and switching back. It also creates a "Masquerade" block for quick switching which can be added to a sidebar or elsewhere on your site. It is visible only to those users with permission to masquerade.

Another module which accomplishes something similar is Role Switcher.

--a different Dan H

| improve this answer | |
  • Thanks for the advice! Although I was hoping to accomplish this without adding any modules or functionality, still, good to know :) – DanH Apr 17 '12 at 3:45
2

I created masquerade_drush in the Masquerade Extras suite to help this exact issue. Check it out http://dgo.to/masquerade_extras

| improve this answer | |
0

For everyone wanting to login as specific user you can use: drush uli --name someuser which will give you one time login link to login as someuser.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.