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?
4 Answers
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
-
Oh yes, I totally forgot about this. Never thought to use it for switching user, thanks!– DanHApr 17, 2012 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. Apr 17, 2012 at 12:13
-
-
-
1@anoopjohn No, it will let you do so, but it won't happen on it's own. Apr 23, 2020 at 8:29
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
-
Thanks for the advice! Although I was hoping to accomplish this without adding any modules or functionality, still, good to know :)– DanHApr 17, 2012 at 3:45
I created masquerade_drush in the Masquerade Extras suite to help this exact issue. Check it out http://dgo.to/masquerade_extras
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
.