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.
Can someone tell us how to list not only forum posts but a mix of ALL the latest posts, in forums, articles etc, all in the same list, also in time order?
Because I am not a lazy administrator and put things all in the one forum. MY front page news is typed directly into the front page they don't have a forum id so how do you propose we do it now then?
Instead of just posting to increase your post count it would be better if you realised everyone was not a lazy administrator and had all the news in one section.
This is working great...Kind of..I may have found a bug
I have a private section that I don't want to appear in the results, but putting the forum id in the array causes the entire widget to not list ANYTHING..Through trial and error I discovered that it is because my forum settings are set to not act as a forum (as a category instead) --> because I only want people going through a private link without seeing other posts should they try to list the parent section..
So my question is this, instead of using the array to EXCLUDE forum id's, how can I set it to only INCLUDE forum ids?
EDIT:
Quote:
Originally Posted by Videx
It only has an exclusion array, so you would have to list all your other forums. Or just edit it and make the list inclusive. Take out the ! in "if (!in_array".
Because I am not a lazy administrator and put things all in the one forum. MY front page news is typed directly into the front page they don't have a forum id so how do you propose we do it now then?
Instead of just posting to increase your post count it would be better if you realised everyone was not a lazy administrator and had all the news in one section.
Offered quick advice from your one liner of why you was uninstalling. Guess next time I won't try and increase my post count all 14 of them. By the way this mod pulls the data from the forum id's, guess were all lazy