Hi BobRay,
here are 4 screendumps taken at the same moment. 2 from the manager and 1 from phpmyadmin and 1 from my custom usermanager. it shows that, allthough the TESTuser is
active=0 in the database. the manager shows the user
active in the userLIST and the userDETAIL page.
I use a snippet to get a list on my custom usermanager (the simplified version)
$c = $modx->newQuery('modUser');
$c->where(array('primary_group' => '3'));
$c->sortby('username', 'ASC');
$users = $modx->getCollection('modUser', $c, false);
foreach ($users as $user) {
$bgcolor = ($bgcolor == "#ffffff") ? "#f9f9f9" : "#ffffff";
$o .= $modx->getChunk('row-user-list', array('id' => $user->get('id')
, 'username' => $user->get('username')
, 'active' => $user->get('active')
, 'bgcolor' => $bgcolor));
}
I'm using a small AJAX call on the custom usermanager to a snippet to set the user active or incative:
$o = '';
if (isset($_REQUEST['id']) && isset($_REQUEST['active'])) {
$id = (isset($_REQUEST['id'])) ? $_REQUEST['id'] : '';
$active = (isset($_REQUEST['active'])) ? $_REQUEST['active'] : '';
$a = ($active == 'false') ? 0 : 1;
$user = $modx->getObject('modUser', $id, false);
$user->set('active', $a);
if (!$user->save()) {
$o .= 'ERROR: Could not save user.';
}else{
$o .= 'OK: save user.';
}
}
return $o;
The snippet seems to work fine because i can see in the database the active field changing its the the pages (espescialy the userlist in the MODX manager) that don't 'refresh'
I hav a feeling the
$users = $modx->getCollection('modUser', $c, false); gets cached somehow
RDG
PS im setting active and inactive on my custom usermanager
[ed. note: rdaneeel last edited this post 11 years, 11 months ago.]