Follow us on Facebook and Twitter!

report viewers
#1
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
Reply
#2
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:
function cmtx_last_activity($seconds) { //converts seconds to a friendly time

    
$days floor($seconds 86400);

    if (
$days >= && $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 
Have you completed the interview?
Reply
#3
sweeeeet - works perfectly, good job!!

Thanks Steven you're a star
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  insert into viewers table died johan 1 892 08-Jun-2015, 07:22 PM
Last Post: Steven

Forum Jump:


Users browsing this thread: 1 Guest(s)