[Plugin] users_online_today some bugs

CerealGuy

  • Posts: 343
[Plugin] users_online_today some bugs
« on January 12th, 2015, 05:28 PM »Last edited on January 13th, 2015, 08:30 AM
Found some bugs in this plugin.

1.
Code: (OnlineToday.php) [Select]
case '7d':
$earliest_type = time() - 604800;
break;

I think that should be "earliest_time".

2. The plugin uses systemtime (time(), strtotime()) therefore there's no need to substract the timezone settings. This error might not appear for some, but they just have those settings set to 0.

Untested solution:
Code: (OnlineToday.php) [Select]
switch ($settings['uot_type'])
{
default:
$settings['uot_type'] = 'today'; // This is deliberate, falling through to 'today' because that's what to use in the event of an invalid type being used.
case 'today':
$earliest_time = strtotime('today');
break;
case '24h':
$earliest_time = time() - 86400;
break;
case '7d':
$earliest_time = time() - 604800;
break;
}
Dont want to fork wedge/plugins, otherwise i would open up a pull request. Im not sure if last_login uses forum time or system time. But however, something is wrong with this plugin.
EDIT:
'last_login' => time()
Changed my solution.