Here is the scenario I’m running into with webloginpe:
1. I log into the system as a user (belongs to group "x")
2. I click the "logout" button. This appears to work
3. I log in as another user (belongs to group "y")
When I do this, it appears to be retaining the group credentials of user #1 and applying to user #2. I can’t tell if this is something to do with the logout/login mechanism of webloginpe or if it is an issue with modx itself (running 9.6.1).
Here is the code that I’m using to check the group credentials:
// Config
$member_top = 4;
$default_home = 22;
// Get list of user groups, grab first one
$grps = $modx->getUserDocGroups(true);
$group = "";
if (count($grps)) {
$group = $grps[0];
}
// If user belongs to a group, send them to their home page (return id)
if ($group) {
$kids = $modx->getDocumentChildren($member_top,1,'0','id, longtitle');
foreach($kids as $kid) {
// Hack: use "longtitle" to identify the "home page" for each group
if ($kid['longtitle'] == $group) {
return $kid['id'];
}
}
}
// Not logged in or have no home page - send to login page
return $default_home;
getUserDocGroups does not appear to be retrieving the correct user’s information for some reason, gets stuck on the first user to log in, even though the page that is calling the snippet is set to non-cacheable.
Any ideas?