Hi,
I have registered users that can access private sections of a site. I’d like to know at any given time how many users are online. Here is the snippet I wrote but it doesn’t seem to be working all the time. Any comments?
$time_to_check = ( (time()+$modx->config['server_offset_time']) -(60*20));
// Don't want manager users only web users
$sql_where = 'internalKey<0 AND '. "lasthit>'$time_to_check'";
$db_result = $modx->db->select('id,username,lasthit',
$modx->getFullTableName('active_users'),
$sql_where');
return strval($modx->db->getRecordCount($db_result)); // Return nb of connected users...
Thanks