Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Details »»

Version: , by Scott MacVicar Scott MacVicar is offline
Developer Last Online: Mar 2016 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 08-17-2001 Last Update: Never Installs: 13
 
No support by the author.

This is probably too small to qualify has a hack but i've seen one or two posts looking for it. This finds the most popular thread on the board.

Open index.php and before
Code:
// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
add either of the following depending on what you want to be picked as most popular.

Code:
//Most Popular Thread by Replies 
$popular=$DB_site->query_first("SELECT * FROM thread ORDER by replycount DESC LIMIT 1");
Code:
//Most Popular Thread by Views 
$popular=$DB_site->query_first("SELECT * FROM thread ORDER by views DESC LIMIT 1");
then below that add the following
Code:
eval("\$popularthread = \"".gettemplate("popular_thread")."\";");
save index.php and upload.

Then within the control panel click add templates.

Template name is popular_thread
and the code should be this
Code:
Most popular thread is <a href="showthread.php?s=$session[sessionhash]&threadid=$popular[threadid]">$popular[title]</a>
Then in either of your forumhome templates place $popularthread and the text "Most populat thread is THREADTITLE"
the threadtitle will be a link to the title.

Show Your Support

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

Comments
  #12  
Old 11-05-2001, 03:04 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is the nonvb page Perl, PHP or ASP??
or are you wishing to call it via SSI.
Reply With Quote
  #13  
Old 11-05-2001, 03:15 PM
pgowder's Avatar
pgowder pgowder is offline
 
Join Date: Nov 2001
Location: West Columbia, SC
Posts: 537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would prefer a ssi call, but I can make the page php if I need to.
Reply With Quote
  #14  
Old 11-05-2001, 04:04 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

simpliest way is if the page is php

PHP Code:
//connect to database
mysql_connect("localhost""YOURUSERNAME""YOURPASS");
mysql_select_db("YOURFORUMSDATABASE");
//select thread information
$popular=mysql_fetch_array(mysql_query("SELECT * FROM thread ORDER by replycount DESC LIMIT 1"));
mysql_close();

$popular="Most popular thread is <a href=\"http://forums.site.com/showthread.php?s=$session[sessionhash]&threadid=$popular[threadid]\">$popular[title]</a>"
then just place $popular somewhere on your page and it will say like
Most popular thread is Some Title Here and the title will be a link to the thread.
Reply With Quote
  #15  
Old 11-05-2001, 05:23 PM
pgowder's Avatar
pgowder pgowder is offline
 
Join Date: Nov 2001
Location: West Columbia, SC
Posts: 537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That did it.

Now, how could I have it include the top 5 most popular??

I want to have a box on my front page with the top 5 threads.

thanks
Reply With Quote
  #16  
Old 11-05-2001, 06:05 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
//connect to database
mysql_connect("localhost""YOURUSERNAME""YOURPASS");
mysql_select_db("YOURFORUMSDATABASE");
//select thread information
$query=mysql_query("SELECT * FROM thread ORDER by replycount DESC LIMIT 5");
while(
$pop=mysql_fetch_array($query)) {
$popular.="<a href=\"http://forums.site.com/showthread.php?s=&threadid=$pop[threadid]\">$pop[title]</a><br>";
}
mysql_close(); 
Use $popular list the top 5 threads with a line break seperating them adjust as you wish.
Reply With Quote
  #17  
Old 12-10-2001, 01:12 PM
cityofangelus's Avatar
cityofangelus cityofangelus is offline
 
Join Date: Dec 2001
Location: UK
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great hack really like this one.

Work perfectly thanks
Reply With Quote
  #18  
Old 12-13-2001, 02:39 PM
Lesane's Avatar
Lesane Lesane is offline
 
Join Date: Oct 2001
Location: The Netherlands
Posts: 1,149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great Hack PPN, i luv it but i had the "Show most popular thread" in a table and my most popular thread has a very long title, more then 40 characters so i reduced it 2 25. If someone is interested, here it is:

root/index.php

find:
PHP Code:
$popular=$DB_site->query_first("SELECT * FROM thread ORDER by replycount DESC LIMIT 1"); 
Under that add:
PHP Code:
    if (strlen($popular[title]) > 25) { 
        
$title substr($popular[title],0,25);
        
$title .= "...";
    } else { 
        
$title $popular[title];
    } 
Then find in popular_thread thread:
PHP Code:
Most popular thread is <a href="showthread.php?s=$session[sessionhash]&threadid=$popular[threadid]">$popular[title]</a
and change it to:
PHP Code:
Most popular thread is <a href="showthread.php?s=$session[sessionhash]&threadid=$popular[threadid]">$title</a
Now with this there will be 25 characters displayed of the Most Popular thread, ofcourse you can change that to your size.
Reply With Quote
  #19  
Old 06-21-2002, 10:29 PM
musicfreak12399's Avatar
musicfreak12399 musicfreak12399 is offline
 
Join Date: Mar 2002
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there a way to do this hack for any specific forum? Because that would be really great for my board if there was a way to do that
Reply With Quote
  #20  
Old 06-22-2002, 11:05 AM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sounds like a great hack!!!

Nice PPN...

And great idea Lesane!!!

Definately installing this one...

Satan
Reply With Quote
  #21  
Old 06-22-2002, 11:29 PM
musicfreak12399's Avatar
musicfreak12399 musicfreak12399 is offline
 
Join Date: Mar 2002
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no one has ansewer to my question? im sure there is a way to do it, but i do not know how...

Quote:
Is there a way to do this hack for any specific forum? Because that would be really great for my board if there was a way to do that
Reply With Quote
Reply

Thread Tools

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 06:40 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04429 seconds
  • Memory Usage 2,319KB
  • Queries Executed 25 (?)
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
  • (5)bbcode_code
  • (6)bbcode_php
  • (1)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
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (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
  • 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