Posts: 74
Threads: 22
Joined: Oct 2013
I think there maybe a bug in the report viewers screen. If you set the timeout to be longer than 1 hr (I have mine set to 43200), in the actual report viewers screen nothing is longer than 1 hr old in 'last activity' - it looks like the hr value is cut away
Posts: 2,894
Threads: 59
Joined: Jun 2010
Hi,
You're right. It wasn't designed to handle times that are over an hour.
I've written a function to handle long times. Would you mind testing it?
If the time is less than an hour, it will display:
00m 00s
More than an hour:
00h 00m 00s
More than a day:
00d 00h 00m 00s
In /comments/admin/includes/pages/report_viewers.php change this:
PHP Code:
<?php echo date("i\m s\s", $timestamp - $viewer["timestamp"]); ?>
.. to this ..
PHP Code:
<?php echo cmtx_last_activity($timestamp - $viewer["timestamp"]); ?>
Then add this anywhere in /comments/admin/includes/functions/general.php
PHP Code:
<?php
function cmtx_last_activity($seconds) { //converts seconds to a friendly time
$days = floor($seconds / 86400);
if ($days >= 1 && $days <= 9) {
$time = '0' . $days . 'd ' . gmdate("H\h i\m s\s", $seconds);
} else if ($days >= 10) {
$time = $days . 'd ' . gmdate("H\h i\m s\s", $seconds);
} else {
if ($seconds >= 3600) {
$time = gmdate("H\h i\m s\s", $seconds);
} else {
$time = gmdate("i\m s\s", $seconds);
}
}
return $time;
} //end of last-activity function