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

Reply
 
Thread Tools
LBmtb's Recent Topics on Non-VB Pages Details »»
LBmtb's Recent Topics on Non-VB Pages
Version: 1.03, by LBmtb LBmtb is offline
Developer Last Online: Aug 2015 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.6.4 Rating:
Released: 12-18-2006 Last Update: 03-26-2007 Installs: 64
 
No support by the author.

RECENT TOPICS by LBmtb
Version 1.03
Last updated: March 27th, 2007

DESCRIPTION
This script will display the topics with the most recent posts on a non-vb page (any HTML page). The page it's on must have a .php extension or you should setup apache to parse the page correctly. The threads with the latest posts are on top. The output is a clean list in this format:

HTML Code:
<ul class="vb_topics">
<li><a href="http://www.yourdomain.com/forum/showthread.php?t=4150">This is the latest thread</a> <span class="vb_last_post">(user1 @ 12/18/06 05:58 PM)</span></li>
<li><a href="http://www.yourdomain.com/forum/showthread.php?t=4138">Another recent thread</a> <span class="vb_last_post">(user2 @ 12/18/06 05:58 PM)</span></li>
</ul>
Customizable options include:
  • forum ID - choose to only include or exclude certain forums
  • number of topics displayed
  • CSS class names for the topic name/url and last poster/date
  • and a few others
COPYRIGHT
There is a copyright line. I am releasing this script on the condition that you do not remove this line unless you send $5 via paypal to webmaster@socaltrailriders.org. Thanks in advance for understanding.

NEED CUSTOMIZATION OR PROFESSIONAL INSTALLATION?
Email me at webmaster@socaltrailriders.org, PM me on vbulletin.org, or aim me at "lbmtb" to inquire about customizing this script or installation.

REVISION HISTORY
Version 1.03: Adds small preview of first post when the user rolls over the links
Version 1.02: option to exclude certain forums
Version 1.01: option to only include certain forums
Version 1.0: Initial Release

INSTRUCTIONS:
1) Copy and paste the following code where you want the list to appear and adjust the values in the section "CUSTOMIZE THE FOLLOWING":

PHP Code:
<?php 
##########################################################################
// RECENT TOPICS by LBmtb
// Version 1.03
// webmaster@socaltrailriders.org OR aim: LBmtb
//
// Do not remove copyright unless you donate $5 via paypal
// to the above email address, thanks
// CUSTOMIZED from a www.phase1media.com script found here:
// https://vborg.vbsupport.ru/showpost.php?p=589067&postcount=7
##########################################################################

## CUSTOMIZE THE FOLLOWING    ##############################################

// DATABASE & URL SETTINGS
$db_host "localhost"// Change this if your MySQL database host is different.
$db_name "db_name"// Change this to the name of your database.
$db_user "db_username"// Change this to your database username.
$db_pw "db_password"// Change this to your database password.
$db_prefix "vb_"// Change to your tables' prefix. Usually vb_
$forum_url "http://www.yourdomain.com/forum"// Change this to reflect to your forum's URL.

// APEARANCE OPTIONS
$seperator "@"// this goes between last poster and date
$limit "10"// Number of posts displayed
$post_date_format "1"// leave as 1 for "12/18/06 05:26 PM" or change to 2 for "05:26 PM"

// use one or the other, not both. if left blank the script will return threads from any forum
$fid_raw ""// ONLY include threads from these forums. seperate each ID with a comma
$fidx_raw ""// Exclude threads from these forum. seperate each ID with a comma

// CSS CLASSES    
$recent_topics "vb_topics"// you can use CSS to adjust the presentation of the list 
$recent_poster "vb_last_post";  // you can use CSS to adjust the presentation the last poster and date

## NO NEED TO TOUCH ANYTHING BELOW    #####################################
#############################################################################

if (!($recent_topics_connection mysql_connect("$db_host""$db_user""$db_pw")))
die (
"could not connect"); 
if (!(
mysql_select_db("$db_name"$recent_topics_connection)))
mysql_error(); 
echo 
"<ul class=\"$recent_topics\">\n";
$fid_array explode (','$fid_raw);
if (
$fid_raw)  {
    
$fid_final .= "AND (";
    foreach( 
$fid_array as $key => $value){
        if (
$key == 0) { $fid_final .= "t.forumid=".$value; }
        else { 
$fid_final .= " OR t.forumid=".$value; }
    }
    
$fid_final .= ")";
}
$fidx_array explode (','$fidx_raw);
if (
$fidx_raw)  {
    
$fidx_final .= "AND NOT (";
    foreach( 
$fidx_array as $key => $value){
        if (
$key == 0) { $fidx_final .= "t.forumid=".$value; }
        else { 
$fidx_final .= " OR t.forumid=".$value; }
    }
    
$fidx_final .= ")";
}
$thread_sql mysql_query("SELECT SQL_CACHE t.threadid,t.title,t.lastpost,t.lastposter,t.forumid,substring(p.pagetext,1,90) as post_text
    FROM "
.$GLOBALS['db_prefix']."thread t
    INNER JOIN "
.$GLOBALS['db_prefix']."post p
    ON t.firstpostid = p.postid
    WHERE t.visible=1 
    AND t.open=1 
$fidi_final $fidx_final 
    ORDER BY t.lastpost desc 
    LIMIT 
$limit");
while(
$thread_get=@mysql_fetch_array($thread_sql))
{
    
$lastpost $thread_get['lastpost'];
    
$poster $thread_get['lastposter'];
    
$tid $thread_get['threadid'];
$text $thread_get['post_text'];
    if (
$post_date_format == "1") { $date2 date ("m/d/y h:i A" ,$lastpost); }
    elseif (
$post_date_format == "2") { $date2 date ("h:i A" ,$lastpost); }
    else { 
$date2 date ("m/d/y h:i A" ,$lastpost); }
        echo 
"<li><a href=\"$forum_url/showthread.php?t=$tid\" title=\"".$text."\">$thread_get[title]</a> <span class=\"$recent_poster\">($poster $seperator $date2)</span></li>\n";
}
echo 
"</ul>\n<div style=\"font-size: .9em;\">recent topics by <a href=\"http://www.socaltrailriders.org/\"><acronym title=\"Southern California Trail Riders\">SocalTrailRiders.org</acronym></a></div>";
mysql_close($recent_topics_connection);
?>
2) Go back to the vbulletin.org thread where you found this and click on "Mark as Installed"
3) Enjoy!
4) Donate (this step optional)


UPGRADE INSTRUCTIONS (from 1.02 to 1.03):


FIND:
Code:
$thread_sql = mysql_query("SELECT threadid,title,lastpost,lastposter FROM ".$db_prefix."thread WHERE visible=1 AND open=1 $fid_final $fidx_final ORDER BY lastpost desc LIMIT $limit");
REPLACE WITH:
Code:
$thread_sql = mysql_query("SELECT SQL_CACHE t.threadid,t.title,t.lastpost,t.lastposter,t.forumid,substring(p.pagetext,1,90) as post_text
    FROM ".$GLOBALS['db_prefix']."thread t
    INNER JOIN ".$GLOBALS['db_prefix']."post p
    ON t.firstpostid = p.postid
    WHERE t.visible=1 
    AND t.open=1 $fidi_final $fidx_final 
    ORDER BY t.lastpost desc 
    LIMIT $limit");
FIND:
Code:
    $tid = $thread_get['threadid'];
AFTER, ADD:
Code:
    $text = $thread_get['post_text'];
FIND AND REPLACE:
Code:
forumid=".$value
WITH:
Code:
t.forumid=".$value
FIND:
Code:
    echo "<li><a href=\"$forum_url/showthread.php?t=$tid\">$thread_get[title]</a> <span class=\"$recent_poster\">($poster $seperator $date2)</span></li>\n";
REPLACE WITH:
Code:
    echo "<li><a href=\"$forum_url/showthread.php?t=$tid\" title=\"".$text."\">$thread_get[title]</a> <span class=\"$recent_poster\">($poster $seperator $date2)</span></li>\n";


UPGRADE INSTRUCTIONS (from 1.01 to 1.02):

FIND:
PHP Code:
// APEARANCE OPTIONS
$seperator "@"// this goes between last poster and date
$fid_raw ""// If you want to restrict to specific forums, enter the forum id(s) here. seperate them with a comma. Otherwise, leave it blank.
$limit "10"// Number of posts displayed
$post_date_format "1"// leave as 1 for "12/18/06 05:26 PM" or change to 2 for "05:26 PM" 
REPLACE WITH:
PHP Code:
// APEARANCE OPTIONS
$seperator "@"// this goes between last poster and date
$limit "10"// Number of posts displayed
$post_date_format "1"// leave as 1 for "12/18/06 05:26 PM" or change to 2 for "05:26 PM"

// use one or the other, not both. if left blank the script will return threads from any forum
$fid_raw ""// ONLY include threads from these forums. seperate each ID with a comma
$fidx_raw ""// Exclude threads from these forum. seperate each ID with a comma 
REPLACE EVERYTHING BELOW:
PHP Code:
## NO NEED TO TOUCH ANYTHING BELOW    ######################################
########################################################################## 
With everything below that same line in 1.02

NOTES:
This is my first mod/script so be nice, please

DEMO:
http://www.socaltrailriders.org/latest_posts.php

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 12-19-2006, 12:48 AM
LBmtb LBmtb is offline
 
Join Date: Jan 2006
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll be cool like all the veterans out there and reserve the first post.
Reply With Quote
  #3  
Old 12-19-2006, 03:48 AM
Murty's Avatar
Murty Murty is offline
 
Join Date: Dec 2005
Location: South Australia
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm... looks interesting. what would this be handy for?
Reply With Quote
  #4  
Old 12-19-2006, 03:56 AM
LBmtb LBmtb is offline
 
Join Date: Jan 2006
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Murty View Post
hmm... looks interesting. what would this be handy for?
Probably most useful for people who have a website outside of their forums. Like my website has some 'static' html pages aside from the forums. There are mods and vBAdvanced modules that do this sort of thing but I never found one that did this on a page outside of vBulletin.

So basically . . . handy for displaying recent forum activity outside of the forums. Check my website link in my sig for an idea of how I use it.
Reply With Quote
  #5  
Old 12-19-2006, 04:51 AM
OmniBuzz OmniBuzz is offline
 
Join Date: Nov 2006
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any chance to have a version that would add an "updated threads" list ?
Like :
palm spring ...(created by outlaw blabla, last answer by neil blabla)
Reply With Quote
  #6  
Old 12-19-2006, 05:01 AM
s0b s0b is offline
 
Join Date: Oct 2006
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great, installed it but i am also interested in the "updated threads"
Reply With Quote
  #7  
Old 12-19-2006, 05:16 AM
LBmtb LBmtb is offline
 
Join Date: Jan 2006
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by OmniBuzz View Post
any chance to have a version that would add an "updated threads" list ?
Like :
palm spring ...(created by outlaw blabla, last answer by neil blabla)
Here ya go:
HTML Code:
<?php 
##########################################################################
// RECENT TOPICS by LBmtb
// webmaster@socaltrailriders.org OR aim: LBmtb
//
// Do not remove copyright unless you donate $5 via paypal
// to the above email address, thanks
// CUSTOMIZED from a www.phase1media.com script found here:
// https://vborg.vbsupport.ru/showpost.php?p=589067&postcount=7
##########################################################################

## CUSTOMIZE THE FOLLOWING	##############################################

// DATABASE & URL SETTINGS
$db_host = "localhost"; // Change this if your MySQL database host is different.
$db_name = "db_name"; // Change this to the name of your database.
$db_user = "db_username"; // Change this to your database username.
$db_pw = "db_password"; // Change this to your database password.
$db_prefix = "vb_"; // Change to your tables' prefix. Usually vb_
$forum_url = "http://www.yourdomain.com/forum"; // Change this to reflect to your forum's URL.

// APEARANCE OPTIONS
$seperator = "@"; // this goes between last poster and date
$forum_id = ""; // If you wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$limit = "10"; // Number of posts displayed
$post_date_format = "1"; // leave as 1 for "12/18/06 05:26 PM" or change to 2 for "05:26 PM"

// CSS CLASSES	
$recent_topics = "vb_topics"; // you can use CSS to adjust the presentation of the list 
$recent_poster = "vb_last_post";  // you can use CSS to adjust the presentation the last poster and date

## NO NEED TO TOUCH ANYTHING BELOW	#####################################
#########################################################################

if (!($recent_topics_connection = mysql_connect("$db_host", "$db_user", "$db_pw")))
die ("could not connect"); 
if (!(mysql_select_db("$db_name", $recent_topics_connection)))
mysql_error(); 
echo "<ul class=\"$recent_topics\">\n";
if ($forum_id) { $forumid = "AND forumid=$forum_id"; }
$thread_sql = mysql_query("SELECT threadid,title,lastpost,lastposter, postusername FROM ".$db_prefix."thread WHERE visible=1 AND open=1 $forumid ORDER BY lastpost desc LIMIT $limit");
while($thread_get=@mysql_fetch_array($thread_sql))
{
	$lastpost = $thread_get['lastpost'];
	$firstpost = $thread_get['postusername'];
	$poster = $thread_get['lastposter'];
	$tid = $thread_get['threadid'];
	if ($post_date_format == "1") { $date2 = date ("m/d/y h:i A" ,$lastpost); }
	elseif ($post_date_format == "2") { $date2 = date ("h:i A" ,$lastpost); }
	else { $date2 = date ("m/d/y h:i A" ,$lastpost); }
	echo "<li><a href=\"$forum_url/showthread.php?t=$tid\">$thread_get[title]</a> <span class=\"$recent_poster\">(created by: $firstpost, last reply by: $poster $seperator $date2)</span></li>\n";
}
echo "</ul>\n<div style=\"font-size: .9em;\">recent topics by <a href=\"http://wwwsocaltrailriders.org/\"><acronym title=\"Southern California Trail Riders\">SocalTrailRiders.org</acronym></a></div>";
mysql_close($recent_topics_connection);
?>
That will stick "(created by: MOSH1DH, last reply by: SAR_boats @ 12/18/06 09:23 PM)" at the end of it. Looks a bit long to me? What would be a better format for it?

Well if you set $post_date_format to 2 then it'll only have 09:23 PM for the last post time. That should ease up on the clutter.

UPDATE: Instructions for this functionality are in post 17.
Reply With Quote
  #8  
Old 12-19-2006, 05:36 AM
OmniBuzz OmniBuzz is offline
 
Join Date: Nov 2006
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

THANKs, I am going to install it today
Well, me being in France (bonjour) any chance to have a 17:00 rather than a 5:00 PM time display ?
Reply With Quote
  #9  
Old 12-19-2006, 05:48 AM
LBmtb LBmtb is offline
 
Join Date: Jan 2006
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by OmniBuzz View Post
THANKs, I am going to install it today
Well, me being in France (bonjour) any chance to have a 17:00 rather than a 5:00 PM time display ?
FIND:
HTML Code:
	if ($post_date_format == "1") { $date2 = date ("m/d/y h:i" ,$lastpost); }
	elseif ($post_date_format == "2") { $date2 = date ("h:i" ,$lastpost); }
	else { $date2 = date ("m/d/y h:i A" ,$lastpost); }
REPLACE WITH:
HTML Code:
	if ($post_date_format == "1") { $date2 = date ("m/d/y H:i A" ,$lastpost); }
	elseif ($post_date_format == "2") { $date2 = date ("H:i" ,$lastpost); }
	else { $date2 = date ("m/d/y H:i A" ,$lastpost); }


edit: removed AM/PM. Thanks for pointing it out, firstrebel
Reply With Quote
  #10  
Old 12-19-2006, 07:19 AM
firstrebel's Avatar
firstrebel firstrebel is offline
 
Join Date: Dec 2005
Location: West London
Posts: 380
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by LBmtb View Post
FIND:
HTML Code:
	if ($post_date_format == "1") { $date2 = date ("m/d/y h:i A" ,$lastpost); }
	elseif ($post_date_format == "2") { $date2 = date ("h:i A" ,$lastpost); }
	else { $date2 = date ("m/d/y h:i A" ,$lastpost); }
REPLACE WITH:
HTML Code:
	if ($post_date_format == "1") { $date2 = date ("m/d/y H:i A" ,$lastpost); }
	elseif ($post_date_format == "2") { $date2 = date ("H:i A" ,$lastpost); }
	else { $date2 = date ("m/d/y H:i A" ,$lastpost); }
Still shows AM/PM after doing this. Nice mod, better than the one from vB's support site, which is never up-to-date.

Installed.

Bob
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 03:02 PM.


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.04979 seconds
  • Memory Usage 2,369KB
  • Queries Executed 24 (?)
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
  • (8)bbcode_code
  • (6)bbcode_html
  • (4)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete