View Full Version : vBulletin CMS Widgets - [WIDGET] Recent Threads
cory_booth
02-19-2010, 10:00 PM
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
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
//Sidebar - Begin Forum Threads
$sb_threads = '
<table class="tborder" cellpadding="'.$stylevar[cellpadding].'" cellspacing="'.$stylevar[cellspacing].'" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat"></td> </tr> </thead> <tbody> <div class="smallfont"> <tr> <td>
'.$toutput.'
</td> </tr> </div> </tbody> </table>
';
//Sidebar - End Forum Threads
echo $sb_threads;
$db->free_result($recent_threads);
$output=ob_get_contents();
ob_end_clean();
Updated to reflect contribution from Inflikted:
https://vborg.vbsupport.ru/showpost.php?p=1994657&postcount=25
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.
Where do you put this in?
cory_booth
02-20-2010, 02:59 PM
PHP Widget in the CMS
zbosskiller
02-20-2010, 02:59 PM
Create a new CMS PHP Widget mate.
zbosskiller
02-20-2010, 03:05 PM
Great little widget Cody, thx.
Any chance you could make this so it works as a centre widget? i.e. above the Articles?
At the moment it is all right sided, which is correct for a sideblock.
If you have any time to do it I'd appreciate it.
Thx
Z
cory_booth
02-20-2010, 03:11 PM
Great little widget Cody, thx.
Any chance you could make this so it works as a centre widget? i.e. above the Articles?
At the moment it is all right sided, which is correct for a sideblock.
If you have any time to do it I'd appreciate it.
Thx
Z
Hmmm....
You mean just center all the text?
$toutput .='<tr><td class="'.$class.'" align="left">
$toutput .='<tr><td class="'.$class.'" align="center">
zbosskiller
02-20-2010, 03:32 PM
It more so something like a block that has a header, in the header it shows
'Thread' | 'Posted By' | 'Views' | 'Last Post''
This is probably a lot of work but thought I would ask as its what I was used to with VB 3.8.4
cory_booth
02-20-2010, 03:49 PM
Oh, gotcha - I know what you mean...
And believe it or not, I had something like that running but dumped it a long time ago.
(just experimenting)...
I'll see what I can scratch up...
zbosskiller
02-20-2010, 03:57 PM
Thx, really appreciate it!
cory_booth
02-20-2010, 05:50 PM
Hey I was thinking....
What if you put this in as a Widget...
https://vborg.vbsupport.ru/showthread.php?t=235841
You could turn off some of the areas and it would act as a threads module...
I don't have it installed, but try making a JS Enhanced Widget
Make a new template and insert:
{vb:raw vsatopstats}
Videx
02-21-2010, 01:33 AM
Thanks. Installed.
For those that want to make it a little smaller (or larger), just edit the "LIMIT 0, 15" line. I dunno what the 0 means, but if I change 15 to 5, I only see 5 newest threads.
RedHacker
02-22-2010, 07:37 AM
Cant show date....
cory_booth
02-22-2010, 03:52 PM
You may wish to check here:
$recent_thread[lastpostdate] = vbdate('M jS', $recent_thread[lastpost], 1);
I suppose this hard-coded date format (M jS) might mess with other country formats.
sqzdog
02-22-2010, 06:07 PM
Hey Cory- nice widget. I would like to use this but have it show latest posts instead of threads. Is there an easy way to do this?
klyde
02-22-2010, 07:58 PM
Cant show date....
Replace:
$recent_thread[lastpostdate] = vbdate('M jS', $recent_thread[lastpost], 1);
by:
$recent_thread[lastpostdate] = vbdate($vbulletin->options['dateformat'] , $recent_thread[lastpost], 1);
cory_booth
02-22-2010, 10:28 PM
Thanks Klyde...
Yeah I messed with things to get it as small as possible as a sidebar.
Videx
02-23-2010, 12:41 AM
Yikes! A user just pointed out that ALL my threads are now being posted to the widget, including posts to our private Admin forums! I tried setting the forums in 'configure', but it seems to be ignoring the selection and is still posting Admin threads.
RedHacker
02-23-2010, 05:00 AM
Thanks now it show fine....
redhawk89
02-26-2010, 02:43 AM
Hey Cory- nice widget. I would like to use this but have it show latest posts instead of threads. Is there an easy way to do this?
x2 definitely this would be an epic widget
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.
cory_booth
02-26-2010, 10:40 AM
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...
x626xblack
02-26-2010, 11:46 AM
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! =)
triff
02-27-2010, 11:19 AM
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.
SGL.
Inflikted
03-01-2010, 06:51 PM
is there an easy way to block out private forums from this?
nevermind figured it out... for those others who wanted to know how
change if (!in_array($recent_thread[forumid], array(105,83,121,110,82,112,109,101,102,72))) {
to the proper forumid's you would like to block
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
//Sidebar - Begin Forum Threads
$sb_threads = '
<table class="tborder" cellpadding="'.$stylevar[cellpadding].'" cellspacing="'.$stylevar[cellspacing].'" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat"></td> </tr> </thead> <tbody> <div class="smallfont"> <tr> <td>
'.$toutput.'
</td> </tr> </div> </tbody> </table>
';
//Sidebar - End Forum Threads
echo $sb_threads;
$db->free_result($recent_threads);
$output=ob_get_contents();
ob_end_clean();
Videx
03-01-2010, 07:48 PM
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).
Inflikted
03-03-2010, 01:26 AM
yea its just a temporary fix. what i would really like to see is recent posts 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.
Videx
03-03-2010, 01:37 AM
Agreed. I suspect we'll see a lot of improvement in these things as more coders install and start working with vb4. For now, this works.
Inflikted
03-03-2010, 02:31 PM
well i am willing to offer money to someone who can make this properly :) based on user permissions.
Videx
03-04-2010, 03:35 AM
Well, this is odd. I can't see any of this widget at all in IE8! It looks good in Firefox and Chrome.
adreen
03-04-2010, 05:56 AM
where is CMS in admincp?
Videx
03-04-2010, 12:40 PM
where is CMS in admincp?It should appear in the left menu. Mine is just below blogs and just above advertising.
alkrida
03-04-2010, 01:51 PM
the arabic for it is :
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, 15
");
$i = 0;
while ($recent_thread = $db->fetch_array($recent_threads))
{
$i++;
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="right"><font color="#CC0000" size="2" face="Tahoma"><a href="showthread.php?t='. $recent_thread[threadid].'">'. $recent_thread[title].'</a></font><br/>';
$toutput .='<font size="1" face="Tahoma">آخر مشاركة بواسطة: <a href="member.php?u='.$recent_thread[lastposterid].'">'.$recent_thread[lastposter].'</a></font><br/>';
$toutput .='<font size="1" face="Tahoma">قسم: <a href="forumdisplay.php?f='.$recent_thread[forumid].'">'.$recent_thread[forumtitle].'</a> | الردود: '.$recent_thread[replycount].'</font><br/>';
$toutput .='<font size="1" face="Tahoma">بتاريخ: <strong>'.$recent_thread[lastpostdate].'</strong> في: <strong>'. $recent_thread[lastposttime].'</strong></font><hr/></td></tr>';
}
//End Thread Counts
//Sidebar - Begin Forum Threads
$sb_threads = '
<table class="tborder" cellpadding="'.$stylevar[cellpadding].'" cellspacing="'.$stylevar[cellspacing].'" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat"></td> </tr> </thead> <tbody> <div class="smallfont"> <tr> <td>
'.$toutput.'
</td> </tr> </div> </tbody> </table>
';
//Sidebar - End Forum Threads
echo $sb_threads;
$db->free_result($recent_threads);
$output=ob_get_contents();
ob_end_clean();
Videx
03-04-2010, 03:16 PM
the arabic for it is :Be very careful. You have translated the broken one. This one will show ALL forums, regardless of a user's permissions. Better to use the second one which gives you an exclusion array.
Inflikted
03-04-2010, 03:34 PM
im going to try my luck with vbadvanced for vbulletin 4.0. it seems there is alot more support and actual useful modules for it. buying the CMS package for vbulletin was a waste of money considering the lack of support for it.
RedHacker
03-06-2010, 05:09 PM
Show the hidden threads... Can show the Unregisters\Registers usergroups....
Burnt
03-07-2010, 05:20 PM
What if I wanted this to just take from one forum? What would I add/change to get that done?
Videx
03-07-2010, 05:32 PM
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".
Fifth Dimension
03-07-2010, 08:51 PM
This isn't working on my site. What I have done wrong? I copied and pasted the info into a new PHP widget, but all I see on the webpage is the text "03-07-2010" in the widget box.
Any ideas?
Videx
03-08-2010, 12:33 AM
This isn't working on my site. What I have done wrong? I copied and pasted the info into a new PHP widget, but all I see on the webpage is the text "03-07-2010" in the widget box.
Any ideas?There's nothing in this code that should print a date without printing the hard coded word "Replies:". But who knows - you haven't even given us a link to look at. Can we assume you have no trouble putting up the default "Recent Posts" widget?
GONUMBER6
03-08-2010, 12:34 AM
is there an easy way to block out private forums from this?
nevermind figured it out... for those others who wanted to know how
change if (!in_array($recent_thread[forumid], array(105,83,121,110,82,112,109,101,102,72))) {
to the proper forumid's you would like to block
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
//Sidebar - Begin Forum Threads
$sb_threads = '
<table class="tborder" cellpadding="'.$stylevar[cellpadding].'" cellspacing="'.$stylevar[cellspacing].'" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat"></td> </tr> </thead> <tbody> <div class="smallfont"> <tr> <td>
'.$toutput.'
</td> </tr> </div> </tbody> </table>
';
//Sidebar - End Forum Threads
echo $sb_threads;
$db->free_result($recent_threads);
$output=ob_get_contents();
ob_end_clean();
I tried to change it, but must be doing something wrong. What exactly do I change?
I pasted this into the widget where you placed it:
if (!in_array($recent_thread[forumid], array(105,83,121,110,82,112,109,101,102,72))) {
and then changed the forum id to the forum I want hidden:
if (!in_array($recent_thread[Moderators Area], array(105,83,121,110,82,112,109,101,102,72))) {
How do I do it the right way??? Thank you in advance cuz I really like this widget!!! :)
AURFSCAN
03-08-2010, 12:44 AM
If you want forum id's 1,2,3,4 hidden then it would look like this
if (!in_array($recent_thread[forumid], array(1,2,3,4))) {
GONUMBER6
03-08-2010, 01:31 AM
Awesome, but it did not work for me. :( I tried 3 times.
Here is the error I am getting:
Parse error: syntax error, unexpected $end in /home/content/32/5565332/html/forums/packages/vbcms/widget/execphp.php(177) : eval()'d code on line 39
GONUMBER6
03-08-2010, 01:36 AM
Thanks, I finally got it.
GONUMBER6
03-08-2010, 01:57 AM
I am sorry to bug you all again, but now the "last post by:" is white, which does not show on the white background of this widget.
Can you tell me what sylvars or coding to change the background (not the font) to the same color as my board? Thanks in advance....
Here is my CMS page: http://www.englishbulldognews.com/forums/content.php
I have the new widget on the bottom of the page until I get it up and running properly to replace the 4.02 standard one, so scroll down plz... :)
Inflikted
03-08-2010, 04:27 AM
change the font colors in the script, i had to modify the colors to make it look right with my theme. sorry i forgot to remove those parts out.
RedHacker
03-08-2010, 07:32 AM
If you want forum id's 1,2,3,4 hidden then it would look like this
if (!in_array($recent_thread[forumid], array(1,2,3,4))) {
Parse error: syntax error, unexpected $end in /home/*****/public_html/packages/vbcms/widget/execphp.php(177) : eval()'d code on line 41
GONUMBER6
03-08-2010, 01:17 PM
Make sure you use the entire code, don't just add the code to the original. Same thing happened to me until I earased and used the entire code.
Inflikted
03-08-2010, 02:21 PM
ya.. its not just one line there is a bracket at the bottom your missing, which doesnt properly close the script.
RedHacker
03-08-2010, 06:57 PM
Make sure you use the entire code, don't just add the code to the original. Same thing happened to me until I earased and used the entire code.
I cant understand...
GONUMBER6
03-08-2010, 07:20 PM
is there an easy way to block out private forums from this?
nevermind figured it out... for those others who wanted to know how
change if (!in_array($recent_thread[forumid], array(105,83,121,110,82,112,109,101,102,72))) {
to the proper forumid's you would like to block
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
//Sidebar - Begin Forum Threads
$sb_threads = '
<table class="tborder" cellpadding="'.$stylevar[cellpadding].'" cellspacing="'.$stylevar[cellspacing].'" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat"></td> </tr> </thead> <tbody> <div class="smallfont"> <tr> <td>
'.$toutput.'
</td> </tr> </div> </tbody> </table>
';
//Sidebar - End Forum Threads
echo $sb_threads;
$db->free_result($recent_threads);
$output=ob_get_contents();
ob_end_clean();
Sorry, use the above code, (the one that was added), don't use the original and then add the code. It does not work that way (yet).
GONUMBER6
03-08-2010, 07:22 PM
How do I change the back ground color of the widget? Mine is currently white with blue/grey shaded in between threads.
Also, how do I increase the amount of recent threads showing? Right now I only show 8, would like to see 20.
Also, how to add a "go to last post" button to it?
Thanks in advance!
alkrida
03-15-2010, 10:08 PM
updata the arabic>>>
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(1,2,3))) {
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">آخر مشاركة بواسطة: <a href="member.php?u='.$recent_thread[lastposterid].'">'.$recent_thread[lastposter].'</a></font><br/></span></b>';
$toutput .='<font size="1" face="verdana,arial">قسم: <a href="forumdisplay.php?f='.$recent_thread[forumid].'">'.$recent_thread[forumtitle].'</a> | الردود: '.$recent_thread[replycount].'</font><br/>';
$toutput .='<font size="1" face="verdana,arial">بتاريخ: <strong>'.$recent_thread[lastpostdate].'</strong> في: <strong>'. $recent_thread[lastposttime].'</strong></font><hr/></td></tr>';
}
}
//End Thread Counts
//Sidebar - Begin Forum Threads
$sb_threads = '
<table class="tborder" cellpadding="'.$stylevar[cellpadding].'" cellspacing="'.$stylevar[cellspacing].'" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat"></td> </tr> </thead> <tbody> <div class="smallfont"> <tr> <td>
'.$toutput.'
</td> </tr> </div> </tbody> </table>
';
//Sidebar - End Forum Threads
echo $sb_threads;
$db->free_result($recent_threads);
$output=ob_get_contents();
ob_end_clean();
you need to clear the Cache :)
thankx
RedHacker
03-16-2010, 06:46 AM
Can help me someone with this...?
I have Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/xxxxx/public_html/packages/vbcms/widget/execphp.php(177) : eval()'d code on line 19
and i put this if (!in_array($recent_thread[Hidden Area], array(132,257,268))) {
Videx
03-16-2010, 09:33 AM
i put this if (!in_array($recent_thread[Hidden Area], array(132,257,268))) {Why have you replaced 'forumid' with 'Hidden Area'? Nobody told you to do that. The only thing you're supposed to change is the numbers of the forums in the array.
RedHacker
03-17-2010, 05:55 AM
Why have you replaced 'forumid' with 'Hidden Area'? Nobody told you to do that. The only thing you're supposed to change is the numbers of the forums in the array.
OK put this
if (!in_array($recent_thread[forumid], array(132,257,268))) {
and show this message:
Parse error: syntax error, unexpected $end in /home/xxxxx/public_html/packages/vbcms/widget/execphp.php(177) : eval()'d code on line 4
e-Peer
03-17-2010, 06:08 AM
^ That error usually means you're missing a closing } before the php end tag (?>).
RedHacker
03-17-2010, 06:49 AM
^ That error usually means you're missing a closing } before the php end tag (?>).
Thanks must be put } before //End Thread Counts
johnny713
03-18-2010, 11:43 PM
Thank you for sharing Cory. This is what I looking for..installed :).
sqzdog
03-18-2010, 11:56 PM
Can anybody figure out how to make this widget scroll? vertical, not horizontal marquee.
BlackThorn
04-06-2010, 01:21 PM
Gread job! installed.
murekhalir
04-06-2010, 05:42 PM
I can't get the widt to work, do i enter it as a php direct execution?
Also - do i just copy and paste the code on the OP literally? without any changes?
Or... would i have to add forum sections / ids in there.
graphicnut
04-16-2010, 12:03 AM
Great widget ;) Where do we edit the styles for it? Thanks in advance
Sorry see it now in the actual code.
How would i make the title larger and bold, sorry for noob Q :)
GONUMBER6
04-17-2010, 03:10 PM
Can this widget be placed on a regular site page (not in vb)? I would like a widget of recent threads on my home page at www.englishbulldognews.com
Thanks! :)
Inflikted
04-18-2010, 06:25 PM
Can this widget be placed on a regular site page (not in vb)? I would like a widget of recent threads on my home page at www.englishbulldognews.com
Thanks! :)
to do that just read this http://www.freefrag.com/guides-tutorials/3355-vbulletin-4-0-recent-posts-frontpage-script.html
The script I posted you can throw that into its own php file as well as externally use it on another site if you know how ofcourse. That script should work for CMS and vBA CMPS and also should work outside vbulletin forums :)
Example: http://www.freefrag.com
Outside Example: http://freefrag.com/outsidesample.php (no css on this one :P but you can stylize it still)
axix20xx
04-20-2010, 07:42 AM
many tahnx installed but onle showed the date
Inflikted
04-20-2010, 10:58 PM
axix you put the coding in the description that means, go back into your widgets and make sure you click on configure to add the code in the proper area.
AnthemToGod
04-27-2010, 08:27 AM
How to hide some forums id ?
widget displays all forum threads but I have some invisible area on my forum... how to except some id's ?
AnthemToGod
04-27-2010, 08:44 AM
How to hide some forums id ?
widget displays all forum threads but I have some invisible area on my forum... how to except some id's ?
find them :)
sql:
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(82,41,159) AND visible = '1' AND open!='10'
ORDER BY lastpost DESC
LIMIT 0, 15
sKippah
04-27-2010, 01:42 PM
Can anybody replace "Last Post By: - Forum: and Posted:" with the vb:phrase code?
Thx
Videx
04-27-2010, 02:01 PM
How to hide some forums id ?
widget displays all forum threads but I have some invisible area on my forum... how to except some id's ?You have incorrectly used the code in the first post instead of reading through the thread and using the code in https://vborg.vbsupport.ru/showpost.php?p=1994657&postcount=25 that includes an exclusion array.
I have no idea why the author hasn't yet updated the first post or at least mentioned the exclusion option.
cory_booth
04-27-2010, 02:54 PM
You have incorrectly used the code in the first post instead of reading through the thread and using the code in https://vborg.vbsupport.ru/showpost.php?p=1994657&postcount=25 that includes an exclusion array.
I have no idea why the author hasn't yet updated the first post or at least mentioned the exclusion option.
Sorry ya'll...
I will get that updated... I am currently retiring from the military, establishing a new home, and looking for a J.O.B. while also trying to finish up my degree. LOL... I miss a lot of the posts sometimes.
Videx
04-27-2010, 04:39 PM
Thanks! Yes, we all understand B.U.S.Y.! But while you're updating, you may also want to mention that removing the ! from that line will make it an inclusion list.
Dr.osamA
04-27-2010, 09:33 PM
thanxx installed + 5 stars
janaf
05-13-2010, 08:38 AM
Installed! Worknig out of the box!
(Yes, to use this widget, your create a new PHP direct execusion widget, save it, open Configure link for it, copy and past the code (may 13:th 2010) unchanged)
Someone with more vB knowledge than me could surely change the SQL query so that only the postings that the current user has rigts to see, will be displayed. Then members of restricted forums could also see those postings from those forums.
Pangramma
05-14-2010, 01:24 PM
Hey, it's any way possible to show the "go to last post" button?
Great alternative for default VB widget, installed! :D
Katoona
05-15-2010, 02:25 AM
I would also like "go to latest post" option, and I was also wondering if it is possible to change the code so that it shows recent threads from one spesific user (I really need this for some sub-pages I am making).
I would really appreciate any help making this possible.
alfisti
05-19-2010, 11:17 PM
I have vb 4.0.3 and the vb_date is not working, only the time is working.
In the position of the date, it shows always M jS.
Any ideas??
Thanks
[Fixed]
GONUMBER6
05-22-2010, 09:13 PM
It seems the widget is configured to pull out the last 24 hours of threads. My forum is not that busy yet (hopefully soon), can we pull 2 days worth instead? How do I change that?
Go to last post button would be nice too. :)
wanno
05-27-2010, 02:03 PM
I have vb 4.0.3 and the vb_date is not working, only the time is working.
In the position of the date, it shows always M jS.
Any ideas??
Thanks
[Fixed]
Put the code in Configure.
janaf
06-12-2010, 10:14 PM
I like this widget!
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?
Videx
06-12-2010, 10:55 PM
I believe this would list new articles, since those are created in a forum (and assuming you included the forum). But not blogs.
janaf
06-12-2010, 11:20 PM
By Articles I meant in the CMS. Would those be included too? Or what do you mean by articles?
merk_aus
06-25-2010, 04:24 AM
By Articles I meant in the CMS. Would those be included too? Or what do you mean by articles?
Yes they are included unfortunately which is why I am uninstalling it.
Ohiocustoms
06-25-2010, 05:47 PM
Yes they are included unfortunately which is why I am uninstalling it.
Just don't typing in the forum id # for them ;)
rsuplido
06-25-2010, 06:40 PM
Any way to add the user's mini avatar just like the default Latest Replies?
Also, why add the forumid condition after the fact? I suggest doing that in SQL like:
and forum.forumid NOT IN (105,83,121,110,82,112,109,101,102,72)
For those asking about going to the last post, 'newpost' is better, since it goes to the first reply that the member hasn't read.
Change:
$recent_thread[threadid].'">'
to
$recent_thread[threadid].'&goto=newpost">'
merk_aus
06-27-2010, 09:39 AM
Just don't typing in the forum id # for them ;)
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.
unknown03
07-04-2010, 03:11 PM
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:
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".
Found it, thanks Videx...
However, this doesn't seem to work
Ohiocustoms
07-05-2010, 02:01 AM
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 :confused:
PS
Admincp>forum&moderators>forum manager
Click on this one - vBCms Comments
At the top
Forum: vBCms Comments (id: 28)
See the id# and include it.
Your Welcome and have a nice day :)
Yurified
07-30-2010, 03:01 PM
Thank you so much for this!
I was wondering is there a way that we can use this for forum sideblock?
avitor
07-31-2010, 04:09 PM
hi
how make the thread'S view count ?
is possible to show this ?
thanks
inqelaab.org
09-17-2010, 07:00 AM
Hi I just got vbulletin 4.0.6 installed and I am not being able to find this location to install this Widget
Plugin System > Manage Products > [Add/Import Product]
lubbie
09-17-2010, 07:21 AM
this is no Plugin or an addon. U have to add the Code as written in the Widget´s decription. Reading might help sometimes
inqelaab.org
09-17-2010, 08:53 PM
Thanks for the tip, reading does help... lol only thing I lack is concentration..
inqelaab.org
09-17-2010, 08:58 PM
@Lubbie , can you tell me how can I show this on home page as well..
jacobsen1
09-23-2010, 01:10 PM
installed, thanks!
Scan Cape Cod
10-01-2010, 05:31 PM
Forgive my ignorance, but is there some comprehensive explanation as to why when I take the code in this mod and add it to the configuration of my php widget, save it, and return to it all I see is what was originally in the configuration box, which is:
$output = date(vB::$vbulletin->options['dateformat']) . "<br />\n";
Go easy kids, I'm a fledgling with this stuff, but my searches of this site for an explanation are coming up empty. I also see a few other questions of this nature in this thread, as the above displays the current date of course in the widget box. I'm obviously missing something, I'm just not versed in this stuff enough to deduce what it is.
Thanks in advance.
Videx
10-01-2010, 06:41 PM
Can you save any widgets? Or you just can't save one with this code?
Scan Cape Cod
10-01-2010, 09:10 PM
Can't save any in PHP format. HTML and the other canned CMS widgets work fine.
Videx
10-01-2010, 09:38 PM
A quick search at vb.com shows it may be a server issue. http://www.vbulletin.com/forum/showthread.php?352233-Cannot-save-PHP-Code-in-Widget&highlight=can%27t+save+php+widgets
Scan Cape Cod
10-01-2010, 11:00 PM
Indeed. I'll check further. Dummy here didn't search beyond .org .... I always seem to find my answers here...shame on me. Thanks for the handhold, I'll take it from here! :D Nice looking addition; I hope I can get it working.
Ronseal
10-20-2010, 07:05 PM
Can anybody help me please? I'm trying to get this widget to display the info on two lines rather than four so I've added a table, however it's having none of it and I'm getting the following error.
Parse error: syntax error, unexpected '<' in /home/mysite/public_html/forum/packages/vbcms/widget/execphp.php(194) : eval()'d code on line 26
Many thanks. Ron :confused:
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>
<table>
<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>';</td>
<td class="'.$class.'" align="right">$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>'; </td>
</tr>
<tr>
<td class="'.$class.'" align="left">$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>'; </td>
<td class="'.$class.'" align="right">$toutput .='<font size="1" face="verdana,arial">Posted: <strong>'.$recent_thread[lastpostdate].'</strong> at: <strong>'. $recent_thread[lastposttime].'</strong></font><hr/></td>
</tr>
</table>
</td></tr>';
}
}
//End Thread Counts
//Sidebar - Begin Forum Threads
$sb_threads = '
<table class="tborder" cellpadding="'.$stylevar[cellpadding].'" cellspacing="'.$stylevar[cellspacing].'" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat"></td> </tr> </thead> <tbody> <div class="smallfont"> <tr> <td>
'.$toutput.'
</td> </tr> </div> </tbody> </table>
';
//Sidebar - End Forum Threads
echo $sb_threads;
$db->free_result($recent_threads);
$output=ob_get_contents();
ob_end_clean();
rsuplido
10-20-2010, 07:22 PM
It has something to do with the
';
at the end of lines 26, 27, and 30. Try removing them.
Ronseal
10-20-2010, 07:46 PM
It has something to do with the ';
Tried removing them '; but still get the same error. Really stuck with this, it should be so easy!
rsuplido
10-20-2010, 07:51 PM
Same exact error? Same line?
Ronseal
10-20-2010, 08:06 PM
Same error but line 27 instead.
mmacrypt
11-20-2010, 02:33 PM
Hey guys, with the .8 upgrade, this widget's colors don't flow with the rest of my site. I've tried finding the control in the StyleVars area but nothing effect it. Not very good at this stuff but can somebody point me in a direction.
As you can see, I have the left side working fine now but just don't know what controls the right widget.
https://vborg.vbsupport.ru/external/2010/11/33.png
cykelmyggen
12-09-2010, 04:35 PM
Sorry for my ignorance, but is there a way to make this fine widget show pictures if listet as the first subject in the post? As for now it just shows the imagelink.
Joey Link
01-23-2011, 10:56 PM
How do we change the color of the text?
HouseAddict
02-09-2011, 08:14 PM
Has anyone figured out how to add the thumbnails to this? As in, beside each post you have the poster's thumbnail of some sort, just to add more "color" to this widget and liven up the actual CMS pages...
I'd kill for that!
Is this working in vB4.1.2?
And if it is did it work out of the box or are there changes required?
Thanks....
Videx
03-17-2011, 02:14 PM
Mine still seems to be working after updating to 4.1.2. But let us know. Be sure to read the entire thread before you install it so you understand the later changes.
Gorgias
04-10-2011, 01:41 PM
For those asking about going to the last post, 'newpost' is better, since it goes to the first reply that the member hasn't read.
Change:
$recent_thread[threadid].'">'to
$recent_thread[threadid].'&goto=newpost">'
I have tested this, but it doesn't work for me (vB4.1.2). It goes to the page of the last post, but always on the top of the page. The link in the widget is
http://www.mydomain.com/forumo/showthread.php?t=7829&goto=newpostand then redirects to
http://www.mydomain.com/forum/showthread.php?t=7829&p=316642instead
http://www.mydomain.com/forum/showthread.php?t=7829&p=316642#post316642
or
http://www.mydomain.com/forum/showthread.php?p=316642#post316642
I have tried to add the correct address... but no one of my tests have work. Does anyone have any idea to fix it?
Thanks in advance.
Regards!!!
shuangddr
05-14-2011, 12:28 AM
how to show Threads full content?
Videx
05-14-2011, 02:58 AM
how to show Threads full content?In a widget? That makes no sense. A single post could fill the whole box.
But if you're really determined, I bet you could edit the code to do that.
sticky
06-01-2011, 04:50 AM
How do I change the color of "last post by" ?
LisaArnold
07-10-2011, 04:14 AM
Hey Cory- nice widget. I would like to use this but have it show latest posts instead of threads. Is there an easy way to do this?
vB already has a widget for recent post ... in vB 4x anyway.
claystation
08-01-2011, 09:19 PM
This is very nice, I am not a php programmer so I am looking of some help with how I might make it so only the threads show up with no reply posts. I am trying to create a widget that contains only unanswered posts.
Thanks
Wordplay
09-20-2011, 12:24 PM
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.
where or how did you find a recent threads widget? i only have recent posts.
Videx
09-20-2011, 06:29 PM
where or how did you find a recent threads widget? i only have recent posts.Unless I'm mistaken, this thread is about a "recent threads" widget. Be careful though, as I think there are better versions than the one in the first post.
peterkohar
10-02-2011, 12:55 PM
why i have space above my first post in this widget ?
how to remove that.
https://vborg.vbsupport.ru/
thanks for the help, will appreciate it much
Wordplay
10-02-2011, 10:48 PM
how do you change how old the threads can be before they stop showing there, and the number of threads to show in this widget?
Wordplay
10-05-2011, 11:53 PM
how do you change how old the threads can be before they stop showing there, and the number of threads to show in this widget?
anything anybody?
Videx
10-06-2011, 12:16 AM
how do you change how old the threads can be before they stop showing there, and the number of threads to show in this widget?Did you look at the code? It's been a while for me, but there's a line "LIMIT 0, 10" that sure sounds like it's setting the output to 10; just lower it.
I don't think you can set a cutoff date easily. If you set the output to 5, it will get 5 regardless of dates.
bada_bing
10-06-2011, 02:23 AM
anyway to make this ajax ?
Videx
10-06-2011, 02:44 AM
anyway to make this ajax ?Depends on how skillful you are. Let us know if you manage it.
Lazorbeam
11-08-2011, 03:08 PM
why i have space above my first post in this widget ?
how to remove that.
http://www.tdwclub.com/0temp/3.png
thanks for the help, will appreciate it much
Link me to your forum and I can fix this. I had the same issue and resolved it, but I can't remember what I had to change. I will have to inspect your page.
tonjohn
11-09-2011, 06:10 PM
The exclusion list should simply be added to the query, no?
Just move the line where you build the list before the query and add it to the WHERE clause.
pportuese
01-30-2012, 12:30 AM
This work on 4.1.10?
This work on 4.1.10?
I'm running 4.1.10 and It's working just fine for Me. :)
how to do it to show for specific forums only ?
PowerboatNation
03-29-2012, 09:52 PM
I apologize for bumping this but does anyone know if it would be possible to pull off showing the forums instead of the threads? I've provided a roughly photoshoped image to explain.
http://iamcdl.com/images/preview.jpg
John Lester
08-03-2012, 05:11 AM
Works for me on 4.1.12 :)
barnsi
08-08-2012, 02:15 PM
Great Work, thank you!
To get the prefix to be shown to the recent thread add:
$recent_thread[prefix_rich] = $vbphrase["prefix_$recent_thread[prefixid]_title_rich"];
$toutput .=''.$recent_thread[prefix_rich].' ';
Widget new:ob_start();
global $vbulletin, $db, $vbphrase;
//Begin Thread Counts
$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 visible = '1' AND open!='10'
ORDER BY lastpost DESC
LIMIT 0, 20
");
$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('j. F Y', $recent_thread[lastpost], 1);
$recent_thread[lastposttime] = vbdate($vbulletin->options['timeformat'], $recent_thread[lastpost]);
$recent_thread[prefix_rich] = $vbphrase["prefix_$recent_thread[prefixid]_title_rich"];
$toutput .='<tr><td class="'.$class.'" align="left"><font size="2" face="verdana,arial"><a href="forumdisplay.php?f='.$recent_thread[forumid].'">'.$recent_thread[forumtitle].'</a></font><br/>';
if('.$recent_thread[prefixid].' <> '')
$toutput .=''.$recent_thread[prefix_rich].' ';
$toutput .='<b><font color="#98B5E2" size="2" face="verdana,arial"><a href="showthread.php?t='. $recent_thread[threadid].'">'. $recent_thread[title].'</a></font></b><br/>';
$toutput .='<font size="1" face="verdana,arial">letzter Eintrag von: <a href="member.php?u='.$recent_thread[lastposterid].'">'.$recent_thread[lastposter].'</a></font><br/>';
$toutput .='<font size="1" face="verdana,arial">am <strong>'.$recent_thread[lastpostdate].'</strong> um <strong>'. $recent_thread[lastposttime].'</strong> Uhr</font><hr/></td></tr>';
}
}
//End Thread Counts
//Sidebar - Begin Forum Threads
$sb_threads = '
<table class="tborder" cellpadding="'.$stylevar[cellpadding].'" cellspacing="'.$stylevar[cellspacing].'" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat"></td> </tr> </thead> <tbody> <div class="smallfont"> <tr> <td>
'.$toutput.'
</td> </tr> </div> </tbody> </table>
';
//Sidebar - End Forum Threads
echo $sb_threads;
$db->free_result($recent_threads);
$output=ob_get_contents();
ob_end_clean();
Draffi
10-24-2012, 09:16 PM
Please, have somebody an idea how to put the last posts (not topics) inside this widget and have somebody a version what shows the avatars?
Thank you in advance
John Lester
10-31-2012, 07:08 PM
Ok so it turns out that none of the forums in the array are being excluded, anyone know why?
Here's my widget code;
<snip> see reply
John Lester
10-31-2012, 09:02 PM
Ok so I missed a page while reading through the thread and found the fix :) My widget code looks like this (for those that still have the same issue) ...
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 forum.forumid not in(4,5,6,7,8,126,127,128,129,132,133) 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 ($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
//Sidebar - Begin Forum Threads
$sb_threads = '
<table class="tborder" cellpadding="'.$stylevar[cellpadding].'" cellspacing="'.$stylevar[cellspacing].'" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat"></td> </tr> </thead> <tbody> <div class="smallfont"> <tr> <td>
'.$toutput.'
</td> </tr> </div> </tbody> </table>
';
//Sidebar - End Forum Threads
echo $sb_threads;
$db->free_result($recent_threads);
$output=ob_get_contents();
ob_end_clean();
fungku
12-30-2012, 06:52 PM
Can this widget be placed on a regular site page (not in vb)? I would like a widget of recent threads on my home page at www.englishbulldognews.com
Thanks! :)
https://vborg.vbsupport.ru/showthread.php?t=293380
RichieBoy67
01-17-2013, 04:55 PM
I would like to display this widget in the center with a large portion of the posts showing. Is this possible?
t18ftw
04-15-2013, 01:40 AM
thank you for this widget
Obi Wan
11-08-2013, 04:17 PM
i can not use the Widget :(
where is the error ?
I have vb4.2.1
emits
10-13-2014, 08:09 PM
It is possible to set one forum? And Is it possible to download user names with avatar?
Bubroid
10-27-2014, 07:55 AM
How can I add 1'st posts text to the block?
barnsi
12-10-2015, 05:43 PM
Hello World!
...how can i INCLUDE only one forum? :confused:
i found one solution in including forum "355":
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?
WHERE NOT ISNULL(threadid) AND forum.forumid IN (355,375,376,377,378,379,380,381,382,383,384,385,3 86,387,388,389,390,391,396,397,392,398,399,393,400 ,401,394,395,402,403,404,366,405,415,416,406,417,4 18,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)
ob_start();
global $vbulletin, $db, $vbphrase;
//Begin Thread Counts
$childlist = 0;
if($fcc355 = $vbulletin->forumcache[355]['childlist'])
{
$childlist = trim(str_replace('-1', '', $fcc355), ',');
}
$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 IN ($childlist) AND visible = '1' AND open!='10'
ORDER BY lastpost DESC
LIMIT 0, 20
barnsi
03-16-2023, 03:26 AM
To INCLUDE only three forums (for example) including all childforums, i found a solution:
ob_start();
global $vbulletin, $db, $vbphrase;
//Begin Thread Counts
$childlist = 0;
$fcc16 = $vbulletin->forumcache[16]['childlist']; // LKW-B?nder
$fcc213 = $vbulletin->forumcache[213]['childlist']; // Vormontage
$fcc256 = $vbulletin->forumcache[256]['childlist']; // Bau 73
$arr = $fcc16 . $fcc213 . $fcc256;
$childlist = trim(str_replace('-1', '', $arr), ',');
$toutput='';
To EXCLUDE only two forums (for example) including all childforums, i found this solution:
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
");
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.