Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

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
  #22  
Old 06-22-2002, 11:56 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you do both of these at the same time?

Quote:
Originally posted by PPN
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");
Exactly how would you insert this?

Code:
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.
Reply With Quote
  #23  
Old 06-23-2002, 03:25 AM
musicfreak12399's Avatar
musicfreak12399 musicfreak12399 is offline
 
Join Date: Mar 2002
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

have it like this

Code:
//Most Popular Thread by Replies 
$popularreply=$DB_site->query_first("SELECT * FROM thread ORDER by replycount DESC LIMIT 1");

Code:
//Most Popular Thread by Views 
$popularview=$DB_site->query_first("SELECT * FROM thread ORDER by views DESC LIMIT 1");

Template Change
Code:
Most popular thread by reply is <a href="showthread.php?s=$session[sessionhash]&threadid=$popularreply[threadid][threadid]">$popularreply[title]</a>
Code:
Most popular thread by views is <a href="showthread.php?s=$session[sessionhash]&threadid=$popularview[threadid][threadid]">$popularview[title]</a>
Reply With Quote
  #24  
Old 06-23-2002, 03:39 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks but I still don't understand quite yet. What about the eval part that goes under it? Don't I need 2 of them? And what do I call the templates? Can you give me the complete code with this stuff in it, please? And is there any way to incorporate Lesane's addon for the character limit in these?

Quote:
Originally posted by musicfreak12399
have it like this

Code:
//Most Popular Thread by Replies 
$popularreply=$DB_site->query_first("SELECT * FROM thread ORDER by replycount DESC LIMIT 1");

Code:
//Most Popular Thread by Views 
$popularview=$DB_site->query_first("SELECT * FROM thread ORDER by views DESC LIMIT 1");

Template Change
Code:
Most popular thread by reply is <a href="showthread.php?s=$session[sessionhash]&threadid=$popularreply[threadid][threadid]">$popularreply[title]</a>
Code:
Most popular thread by views is <a href="showthread.php?s=$session[sessionhash]&threadid=$popularview[threadid][threadid]">$popularview[title]</a>
Reply With Quote
  #25  
Old 06-23-2002, 05:42 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How could I do this for the following code?

Code:
//Most Popular Thread by Replies 
$popularreply=$DB_site->query_first("SELECT * FROM thread ORDER by replycount DESC LIMIT 1");

//Most Popular Thread by Views 
$popularview=$DB_site->query_first("SELECT * FROM thread ORDER by views DESC LIMIT 1");
Quote:
Originally posted by Lesane
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.
Reply With Quote
  #26  
Old 06-23-2002, 05:45 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

musicfreak12399,

I figured it out. Instead of making any templates, I just used the template code you gave directly in the forum home template. I put the first 2 parts in the index.php and that last 2 lines of code in the forumhome template. Is that what you meant?
Reply With Quote
  #27  
Old 08-03-2002, 09:33 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any way to make these so they won't show a private forum or thread?
Reply With Quote
  #28  
Old 03-27-2003, 02:12 AM
Snapperhaed Snapperhaed is offline
 
Join Date: Mar 2003
Location: Argentina
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice Hack thanks. Installed on v2.3 #3 Easily. The code I used was that which was posted by 'musicfreak12399' above. There is a slight code difference.

On the forum home template, you will note that his code has an extra: '[threadid]' on it - While it will work that way, its not correct. Just remove it from the end and you should be fine.

Thanks!
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 09: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.04524 seconds
  • Memory Usage 2,292KB
  • 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
  • (17)bbcode_code
  • (3)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
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)postbit_onlinestatus
  • (8)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_postinfo_query
  • fetch_postinfo
  • 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