The following code
function osc_total_users($type = '', $condition = '') {
switch($type) {
case 'active':
return User::newInstance()->countUsers('b_active = 1');
break;
case 'enabled':
return User::newInstance()->countUsers('b_enabled = 1');
break;
case 'online':
$limit_seconds = 300; // 5 minutes
$threshold = date('Y-m-d H:i:s', strtotime(' -' . $limit_seconds . ' seconds', time()));
return User::newInstance()->countUsers(sprintf('b_enabled = 1 AND b_active = 1 AND dt_access_date >= "%s"', $threshold));
break;
case 'custom':
return User::newInstance()->countUsers($condition);
break;
default:
return User::newInstance()->countUsers();
break;
}
}
In the osclass 8.0.3
Added
But can the code be modified?
The code counts the number of users registered on the site online
We want the number of site visitors, not registered users
Thanks