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.
I like it. But it REALLY needs to check user perms and only show things they have access to. Also would need an exclude list in general for forums that you never want to appear.
Also would be good if it used the colors (optional of course) set for the usergroup.
Really nice though, no slight meant! I like the compactness of it and fleshed out a bit more, I'll be using it for sure.
I totally agree with you and in fact felt a bit guilty when an above user pointed out the permission flaw... However, I am learning and was holding these little toys back but decided, what the heck - get 'em on here in the hopes someone with much greater skill than myself turns them into a more professional plugin...
Difference between this and the New Addition to the CMS for 4.0.2 "Recent Threads"?
I do believe it is built in now and there are no permission issues.
I totally agree with you and in fact felt a bit guilty when an above user pointed out the permission flaw... However, I am learning and was holding these little toys back but decided, what the heck - get 'em on here in the hopes someone with much greater skill than myself turns them into a more professional plugin...
No worries Cory, I really appreciate all of the things you have been releasing! =)
What I would LOVE to see is a "recent post" widget with first the threadname (w/link to thread) and then some from the last post of that thread (w/link to the first UNREAD post). Like they had for old vBaCMPS.
I figured it must be a simple matter of using an exclusion array, but I just didn't have the time to mess with it myself, so thanks for that. I'll try to test it later today.
A few suggestions to Cory before you include this: Maybe add a variable near the top so users don't have to go searching for the array; and specify what to put for ALL forums ('0' I guess), and an example of how to put numbers in the array (e.g. I don't think spaces will work).
yea its just a temporary fix. what i would really like to see is recentposts displayed based on user permission, so i don't have to filter boards. sorta like the 'whats new tab' i just don't no how to implement that.