*

rooman

  • ****
  • 231 posts
Show the number of site visitors in Footer
« on: May 01, 2024, 05:21:21 PM »
The following code
Code: [Select]
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

*

MB Themes

Re: Show the number of site visitors in Footer
« Reply #1 on: May 01, 2024, 08:07:37 PM »
No, for number of visitors you need different approach.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: Show the number of site visitors in Footer
« Reply #2 on: May 02, 2024, 10:06:37 AM »
No, for number of visitors you need different approach.
This policy is located in the Control Panel You could use this approach!