Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[WIDGET] Recent Threads Details »»
[WIDGET] Recent Threads
Version: 1.00, by cory_booth cory_booth is offline
Developer Last Online: Jun 2013 Show Printable Version Email this Page

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 

//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....7&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.

Screenshots

File Type: jpg forum.jpg (83.4 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
psd_hunter

Comments
  #22  
Old 02-26-2010, 10:40 AM
cory_booth cory_booth is offline
 
Join Date: Jul 2006
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Trek View Post
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...
Reply With Quote
  #23  
Old 02-26-2010, 11:46 AM
x626xblack x626xblack is offline
 
Join Date: Oct 2009
Location: Houston Tx.
Posts: 183
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #24  
Old 02-26-2010, 05:52 PM
Trek Trek is offline
 
Join Date: Sep 2003
Posts: 664
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cory_booth View Post
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! =)
Reply With Quote
  #25  
Old 02-27-2010, 11:19 AM
triff's Avatar
triff triff is offline
 
Join Date: Sep 2007
Location: Norway
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #26  
Old 03-01-2010, 06:51 PM
Inflikted Inflikted is offline
 
Join Date: Mar 2002
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Code:
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
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 

//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(); 
Reply With Quote
  #27  
Old 03-01-2010, 07:48 PM
Videx's Avatar
Videx Videx is offline
 
Join Date: Feb 2007
Posts: 3,085
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #28  
Old 03-03-2010, 01:26 AM
Inflikted Inflikted is offline
 
Join Date: Mar 2002
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #29  
Old 03-03-2010, 01:37 AM
Videx's Avatar
Videx Videx is offline
 
Join Date: Feb 2007
Posts: 3,085
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #30  
Old 03-03-2010, 02:31 PM
Inflikted Inflikted is offline
 
Join Date: Mar 2002
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well i am willing to offer money to someone who can make this properly based on user permissions.
Reply With Quote
  #31  
Old 03-04-2010, 03:35 AM
Videx's Avatar
Videx Videx is offline
 
Join Date: Feb 2007
Posts: 3,085
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, this is odd. I can't see any of this widget at all in IE8! It looks good in Firefox and Chrome.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:42 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04645 seconds
  • Memory Usage 2,384KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete