Quote:
Originally Posted by SBlueman
What do I need to change in these bits of code in articles.php make it where the "Most Read" and "Most Commented" so that the modules only list the top articles in the last "X" amount of days?
|
hey Blueman, try this (its working for me), we just need to format current date with the days we want minus thread dateline. We create $datecut variable and a condition the query
This for most read:
PHP Code:
if (in_array('mostread', $af_modules))
{
$row = 0;
$af_mrpp = $vbulletin->options[af_mrpp];
// Change the first 90* for the days you want
$datecut = TIMENOW - (90*24*60*60);
$threads = $db->query_read("
SELECT thread.threadid,thread.title AS threadtitle
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "post AS post
ON (post.postid = thread.firstpostid)
WHERE thread.dateline > $datecut AND thread.forumid IN ($forumids)
and this for most comment:
PHP Code:
if (in_array('mostcommented', $af_modules))
{
$row = 0;
$af_mcpp = $vbulletin->options[af_mcpp];
// Change the first 90* for the days you want
$datecut = TIMENOW - (90*24*60*60);
$threads = $db->query_read("
SELECT thread.threadid,thread.title AS threadtitle
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "post AS post
ON (post.postid = thread.firstpostid)
WHERE thread.dateline > $datecut AND thread.forumid IN ($forumids)
Enjoy it.