Version: 1.00, by cory_booth
Developer Last Online: Jun 2013
Category: vBulletin CMS Widgets -
Version: 4.0.2
Rating:
Released: 02-19-2010
Last Update: Never
Installs: 128
Re-useable Code Is in Beta Stage
No support by the author.
In an attempt at mirroring an old ASP website I used to have, I modified the recent threads display to show a bit more information in a bit more compressed format.
Feel free to use/hack/slash this code for your own needs...
Navigate to AdminCP -> CMS -> Widgets.
Create a PHP Type Widget and paste the below code.
READ BELOW THE CODE FOR AN UPDATE
PHP Code:
ob_start();
global $vbulletin, $db;
//Begin Thread Counts
$toutput='';
$recent_threads = $vbulletin->db->query_read("
SELECT thread.threadid, thread.title, thread.dateline, thread.lastpost, thread.lastposter, thread.lastposterid, thread.visible, thread.open, thread.postusername, thread.postuserid, thread.replycount, thread.views, forum.forumid, forum.title as forumtitle
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "forum AS forum ON ( forum.forumid = thread.forumid )
WHERE NOT ISNULL(threadid) AND visible = '1' AND open!='10'
ORDER BY lastpost DESC
LIMIT 0, 10
");
$i = 0;
while ($recent_thread = $db->fetch_array($recent_threads))
{
$i++;
if (!in_array($recent_thread[forumid], array(105,83,121,110,82,112,109,101,102,72))) {
if ($i & 1) {$class='alt1';} else {$class='alt2';}
$recent_thread[title] = unhtmlspecialchars($recent_thread[title]);
$recent_thread[lastpostdate] = vbdate('M jS', $recent_thread[lastpost], 1);
$recent_thread[lastposttime] = vbdate($vbulletin->options['timeformat'], $recent_thread[lastpost]);
$toutput .='<tr><td class="'.$class.'" align="left"><b><font color="#98B5E2" size="1" face="verdana,arial"><a href="showthread.php?t='. $recent_thread[threadid].'">'. $recent_thread[title].'</a></font></b><br/>';
$toutput .='<b><span style="color: #E1E1E2"><font size="1" face="verdana,arial">Last Post By: <a href="member.php?u='.$recent_thread[lastposterid].'">'.$recent_thread[lastposter].'</a></font><br/></span></b>';
$toutput .='<font size="1" face="verdana,arial">Forum: <a href="forumdisplay.php?f='.$recent_thread[forumid].'">'.$recent_thread[forumtitle].'</a> | Replies: '.$recent_thread[replycount].'</font><br/>';
$toutput .='<font size="1" face="verdana,arial">Posted: <strong>'.$recent_thread[lastpostdate].'</strong> at: <strong>'. $recent_thread[lastposttime].'</strong></font><hr/></td></tr>';
}
}
//End Thread Counts
Be SURE to update the following line:if (!in_array($recent_thread[forumid], array(105,83,121,110,82,112,109,101,102,72))), to group the forumids you wish to NOT have included in the query results.
LEFT JOIN " . TABLE_PREFIX . "forum AS forum ON ( forum.forumid = thread.forumid ) WHERE NOT ISNULL(threadid) AND forum.forumid = '355' AND visible = '1' AND open!='10'
...but how can i include all the childforums under forum 355?
PHP Code:
WHERE NOT ISNULL(threadid) AND forum.forumid IN (355,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,396,397,392,398,399,393,400,401,394,395,402,403,404,366,405,415,416,406,417,418,407,419,420,408,421,422,423,424,425,426,427,428,429,430,409,410,431,432,411,412,413,414,433,434) AND visible = '1' AND open!='10'
...the more comfortable way to include one forum including complete childlist:
(in this example forum 355)
thread.views, forum.forumid, forum.title as forumtitle FROM " . TABLE_PREFIX . "thread AS thread LEFT JOIN " . TABLE_PREFIX . "forum AS forum ON ( forum.forumid = thread.forumid ) WHERE NOT ISNULL(threadid) AND forum.forumid IN ($childlist) AND visible = '1' AND open!='10'
To EXCLUDE only two forums (for example) including all childforums, i found this solution:
PHP Code:
ob_start(); global $vbulletin, $db, $vbphrase; //Begin Thread Counts $fcc355 = $vbulletin->forumcache[355]['childlist']; // Forum Anlagenw?rter $fcc455 = $vbulletin->forumcache[455]['childlist']; // Forum Pistolenlebenslauf
$arr = $fcc355 . $fcc455; // Foren, die ausgeblendet werden sollen $arr = trim(str_replace('-1', '', $arr), ',');
$toutput=''; $recent_threads = $vbulletin->db->query_read(" SELECT thread.threadid, thread.prefixid, thread.title, thread.dateline, thread.lastpost, thread.lastposter, thread.lastposterid, thread.visible, thread.open, thread.postusername, thread.postuserid, thread.replycount, thread.views, forum.forumid, forum.title as forumtitle FROM " . TABLE_PREFIX . "thread AS thread LEFT JOIN " . TABLE_PREFIX . "forum AS forum ON ( forum.forumid = thread.forumid ) WHERE NOT ISNULL(threadid) and forum.forumid not in ($arr) AND visible = '1' AND open!='10' ORDER BY lastpost DESC LIMIT 0, 50 ");