MyBB Community Forums

Full Version: Show Most Viewed Threads based on days?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hai all, I want to show most viewed threads based on 7 days  before today, can anybody help me out?

I create this code

if(!$most_viewed)
{
    $cache->update_most_viewed_threads();
    $most_viewed = $cache->read("most_viewed_threads", true);
}
$x = 0;
if(!empty($most_viewed))
{
    foreach($most_viewed as $key => $thread)
    {
        $x+=1;
        if($x <= 7)  
        {
            $thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
            $numberbit = my_number_format($thread['views']);
	   
            $thread['threadlink'] = get_thread_link($thread['tid']);
            eval("\$diskusi_most .= \"".$templates->get("index_most_viewed")."\";");
        }
    }
}
but how to filter it to 7 days before today only?

thanks Big Grin