Jump to content

Guests online


mattsmith

Recommended Posts

  • Moderators

Have you tried lorthon's solution:

You would have to change the following in the StatsData

public static function UsersOnline($minutes = '')
       {
               $key = 'users_online';
               $users_online = CodonCache::read($key);

               if($users_online === false)
               {
                       if($minutes == '')
                               $minutes = Config::Get('USERS_ONLINE_TIME');

                       $sql = "SELECT p.*
                                       FROM ".TABLE_PREFIX."pilots p, ".TABLE_PREFIX."sessions s
                                       WHERE s.pilotid = p.pilotid 
                                       AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL {$minutes} MINUTE) <= s.`logintime`";

                       $users_online = DB::get_results($sql);

                       # Check if it's blank, then return an empty array
                       if(!$users_online)
                               $users_online = array();

                       CodonCache::write($key, $users_online, 'short');
               }

               return $users_online;
       }

The problem is you would also have to remove the cache of this query. Since the query may keep the list old even if you change the time comparison in the query. So change the USER_ONLINE_TIME to say 1 min ( a least it will be closer) and then remove the cache scripting.

Also, have you tried to edit the USERS_ONLINE_TIME setting on your local.config.php?

# The StatsData::UserOnline() function - how many minutes to check
Config::Set('USERS_ONLINE_TIME', 20);

Where 20, replace this with the number of minutes you would like to "keep the sessions".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...