ltd
01-08-2008, 06:41 AM
$replies = $vbulletin->options['my_popular_replies'];
$views = $vbulletin->options['my_popular_views'];
$days = $vbulletin->options['my_popular_days'];
$amount = $vbulletin->options['my_popular_amount'];
$now = TIMENOW;
$stamp = $days * 86400;
$pop_threads = $db->query_read("SELECT thread.threadid, thread.title, thread.iconid AS threadiconid, iconpath AS threadiconpath, thread.lastpost, thread.forumid, forum.title_clean, thread.replycount, thread.postuserid, thread.postusername, thread.lastposter, thread.dateline, IF(views<=thread.replycount, thread.replycount+1, views) AS views, thread.visible, user.username, user.userid, user.usergroupid, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
FROM " . TABLE_PREFIX . "thread AS thread LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.username = thread.lastposter) LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON (icon.iconid = thread.iconid) LEFT JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = thread.forumid)
WHERE NOT ISNULL(thread.threadid) AND thread.visible = '1' AND (thread.replycount >= $replies AND views >= $views) AND thread.dateline >= ($now - $stamp) ORDER BY replycount DESC LIMIT 0, $amount");
while ($popthread = $db->fetch_array($pop_threads))
{
$popthread[title] = substr(htmlspecialchars(strip_tags($popthread[title])),0,65);
if ($popthread[lastpost] > $vbulletin->userinfo['lastvisit'])
{
$popthread[newpost] = true;
}
$popthread[musername] = fetch_musername($popthread);
$poppostdate = vbdate($vbulletin->options['dateformat'], $popthread[lastpost]);
$popposttime = vbdate($vbulletin->options['timeformat'], $popthread[lastpost]);
eval('$popularthreads .= "' . fetch_template('forumhome_my_mpt_bit') . '";');
}
$db->free_result($pop_threads);
Can someone please modify this so that it checks for viewing permissions before showing the threads to users.
$views = $vbulletin->options['my_popular_views'];
$days = $vbulletin->options['my_popular_days'];
$amount = $vbulletin->options['my_popular_amount'];
$now = TIMENOW;
$stamp = $days * 86400;
$pop_threads = $db->query_read("SELECT thread.threadid, thread.title, thread.iconid AS threadiconid, iconpath AS threadiconpath, thread.lastpost, thread.forumid, forum.title_clean, thread.replycount, thread.postuserid, thread.postusername, thread.lastposter, thread.dateline, IF(views<=thread.replycount, thread.replycount+1, views) AS views, thread.visible, user.username, user.userid, user.usergroupid, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
FROM " . TABLE_PREFIX . "thread AS thread LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.username = thread.lastposter) LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON (icon.iconid = thread.iconid) LEFT JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = thread.forumid)
WHERE NOT ISNULL(thread.threadid) AND thread.visible = '1' AND (thread.replycount >= $replies AND views >= $views) AND thread.dateline >= ($now - $stamp) ORDER BY replycount DESC LIMIT 0, $amount");
while ($popthread = $db->fetch_array($pop_threads))
{
$popthread[title] = substr(htmlspecialchars(strip_tags($popthread[title])),0,65);
if ($popthread[lastpost] > $vbulletin->userinfo['lastvisit'])
{
$popthread[newpost] = true;
}
$popthread[musername] = fetch_musername($popthread);
$poppostdate = vbdate($vbulletin->options['dateformat'], $popthread[lastpost]);
$popposttime = vbdate($vbulletin->options['timeformat'], $popthread[lastpost]);
eval('$popularthreads .= "' . fetch_template('forumhome_my_mpt_bit') . '";');
}
$db->free_result($pop_threads);
Can someone please modify this so that it checks for viewing permissions before showing the threads to users.