when an admin or parent user log in to his panel, in user list can see an option to impersonate child user.
when impersonate by a username, he can check privilege and user interface of child user, after impersonate, in header parent user can a message like this:
you loged in as 'David', to back to admin(parent) click here
impersonate user
-
- User
- Posts: 293
impersonate user
-
- User
- Posts: 480
This can be done quite easily already - we implemented it in some projects since v9.2
Just use jQuery to place a button somewhere sensible and reload the page with a 'switch' or 'switchback' query parameter.
In the page header, add a small section of code that copies and replaces / reverts the relevant $_SESSION[] values.
It works very well - doesn't even log out users, so it's a great for support / admin / management staff to quickly log in as a client user and see what they see :-)
-
- User
- Posts: 480
Put something like this in the head:
// switch from admin/staff to a regular profile
if (CurrentUserLevel() != 1 && isset($_GET['SetProfile'])) {
$_SESSION['_ROOT_PROFILE'] = array(
'SysAdmin' => $_SESSION['YourProject_SysAdmin'],
'Level' => $_SESSION['YourProject_status_UserLevel'],
'ID' => $_SESSION['YourProject_status_UserName']
);
$_SESSION['YourProject_SysAdmin'] = 0;
$_SESSION['YourProject_status_UserLevel'] = 0;
unset($_SESSION['YourProject_status_UserLevelValue']);
$_SESSION['YourProject_status_UserName'] = (int) $_GET['SetProfile'];
$_SESSION['YourProject_status_UserProfile_UserName'] = (int) $_GET['SetProfile'];
header("Location: your_default_page.php");
exit;
}
// resume to admin/staff from a regular profile
else if (CurrentUserLevel() == 0 && isset($_GET['ResumeRootProfile']) && isset($_SESSION['_ROOT_PROFILE'])) {
$_SESSION['YourProject_SysAdmin'] = $_SESSION['_ROOT_PROFILE']['SysAdmin'];
$_SESSION['YourProject_status_UserLevel'] = $_SESSION['_ROOT_PROFILE']['Level'];
$_SESSION['YourProject_status_UserName'] = $_SESSION['_ROOT_PROFILE']['ID'];
$_SESSION['YourProject_status_UserProfile_UserName'] = $_SESSION['_ROOT_PROFILE']['ID'];
unset($_SESSION['_ROOT_PROFILE']);
header("Location: your_default_page.php");
exit;
}
...and then put some jQuery in the footer to display a 'switch' / 'switch back' button.
The most sensible places for buttons would be in each row of the users List/Grid page and on the View page.
It's pretty simple to implement and really makes life easier for staff :)