Admin Can Login as Any User
Author Message
After activation, this adds two option to user profiles, only visible to administrators:
  • Login as this user
  • Force logout
The first allows the administrator to effectively login to the account without the user's password.  Everything behaves normally in this login state.  The only difference is that logging out will return the administrator back to their original account.
(note, please don't use this to log into another administrator's account, and then log into some other account from there, though I haven't tried what happens if you do this)

The second option just forces the user to log out if they have logged in somewhere.

Alternative version: Login As by burnacid
(This post was last modified: 06-05-2018 09:30 AM by ZiNgA BuRgA.)
Find all posts by this user
Quote this message in a reply
Download: admhijack.php (3.68 KB)
Plugin Version: 1.2
Last Updated: 11-02-2011, 10:09 PM

Downloads: 4,306
MyBB Compatibility: 1.2.x, 1.4.x, 1.6.x, 1.8.x
Uploader: ZiNgA BuRgA
hego555 Offline
Junior Member
**
Posts: 1
Joined: Oct 2011
Post: #41
RE: Admin Can Login as Any User
Great plugin now how do I do it so some admins cant use it Smile

That should be a feature Smile
10-18-2011 10:26 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #42
RE: Admin Can Login as Any User
Open the plugin file in a text editor, find all instances of

PHP Code:
($mybb->usergroup['cancp'] != 'yes' && $mybb->usergroup['cancp'] != 1)

replace with

PHP Code:
(!in_array($mybb->user['uid'], array(1,2,3)))


and find

PHP Code:
($mybb->usergroup['cancp'] == 'yes' || $mybb->usergroup['cancp'] == 1)

replace with

PHP Code:
(in_array($mybb->user['uid'], array(1,2,3)))


In the above replacements, put a comma separated list of allowed user IDs in place of "1,2,3".


My Blog
10-18-2011 03:41 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #43
RE: Admin Can Login as Any User
Lol, no-one found this in the few years that this plugin has been up.

Updated to v1.2: fix a slight security vulnerability with the force logout feature.

My Blog
11-02-2011 10:10 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #44
RE: Admin Can Login as Any User
Thanks for the update, Yumi Biggrin

11-03-2011 04:12 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #45
RE: Admin Can Login as Any User
I use this plugin mainly in two circumstances:

On my localhost to test settings for various user types without having to make a round trip to the admin CP and on my live board when a user can only vaguely tell me "X does not work" and it is easier to log in as that user rather than spend ages trying to find out their issue. In short a very handy plugin and one I use rather more than I thought I would. Which brings me to my point...

I am thinking about installing Tomm's MyNetwork Profile Module set up (mainly for the comments addon) and this plugin is of course not compatible with it as Tomm has made his own profile module. I see that more and more boards are using that module and I wondered if you would either - make a version of the Admin Hijack plugin that is compatible with MyNetwork Profiles or give some pointers on how I can edit the existing plugin to work with the MyNetwork Profile Module.

Thank you.


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 05-16-2012 03:01 AM by leefish.)
05-16-2012 03:01 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #46
RE: Admin Can Login as Any User
I can't imagine this being incompatible.  It would probably just be failing to do template modifications?

My Blog
05-16-2012 07:31 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #47
RE: Admin Can Login as Any User
I think the problem is that hooks change, the member_profile_start(end) hooks don't work anymore.

I get to add my information in MyNetwork only into a new tab, but adding my own variable was no possible for me.

If you just need to edit templates IIRC MyNetworks offers some functions to fin/replace templates just like mybb already does.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
05-16-2012 02:14 PM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #48
RE: Admin Can Login as Any User
Well, it is definitely the hooks; I looked at that and yes Tomm has replaced the templates and the hooks. So there is nowhere for the plugin to start and the template cache is not available to call.

MYNetwork has a complete set of its own templates.


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 05-16-2012 05:03 PM by leefish.)
05-16-2012 05:02 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #49
RE: Admin Can Login as Any User
So it seems that it's a completely different page - arguably responsibility lies with it to be compatible with existing plugins.
But anyway, being too lazy to install that thing and test, does the following do anything?
In adminhijack.php, replace 'member_profile_end' with 'myn_profile_end'

My Blog
05-29-2012 01:40 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #50
RE: Admin Can Login as Any User
I tried that Zinga - no result. I think it is because the link in the admin hijack is looking to do a "replace" of modoptions on the member profile template and that is no longer there.

I think I will work on using the existing profiles and not bother with the fancy comments. There is a major flaw in that really anyway - if I reply on another users profile and that user replies to me on their profile then I have to remember to go back and look - no notification. I think it is a good thing regarding keeping posting on the board, but still a flaw in the Profile plugin. (The MyNetwork one, not yours).


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 05-30-2012 12:10 AM by leefish.)
05-30-2012 12:06 AM
Visit this user's website Find all posts by this user Quote this message in a reply


Forum Jump: