Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-26-2013, 12:32 PM
addamroy addamroy is offline
 
Join Date: Sep 2010
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Change Number of Threads per Page (SPECIFIC FORUM)

I'm trying to figure out a way to change the # of threads per page, but only for a specific forum. I couldn't find a mod so I figured I'd post here and maybe someone knows of a template edit I can make.

It's already set in my vb options settings to show 20 per page, however I have one section of the forum I would like to limit to 10 per page.

I was looking through the FORUMDISPLAY template but couldn't get an eye on the code that says how many threads to show in the thread list. (assuming this is even the right template)

I was hoping I could wrap an if condition around some code, (where x = the forum id I want to limit to 10 threads)
Code:
<vb:if condition="$GLOBALS[forumid] != x">Existing code that determines how many threads are displayed</vb:if>

<vb:if condition="$GLOBALS[forumid] == x">Custom code that determines how many threads are displayed</vb:if>
Any ideas?
Reply With Quote
  #2  
Old 01-26-2013, 06:34 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think you want a plugin, not a template edit.

hook - forumdisplay_start
php code
PHP Code:
if ($foruminfo['forumid'] == x) {
$vbulletin->options['maxthreads'] = "10";

Change x to the forumid
Reply With Quote
Благодарность от:
addamroy
  #3  
Old 01-26-2013, 09:25 PM
addamroy addamroy is offline
 
Join Date: Sep 2010
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perfect Lynne thank you!

Now how do I turn that into an add-on so I can submit it to the mod forums? I only know how to do template edits so that's all I've ever posted there
Reply With Quote
  #4  
Old 01-27-2013, 03:07 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's a plugin. You may add it to a product and then turn the forumid into a setting (probably want to change the condition into an array).
Reply With Quote
  #5  
Old 01-27-2013, 05:16 AM
addamroy addamroy is offline
 
Join Date: Sep 2010
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
It's a plugin. You may add it to a product and then turn the forumid into a setting (probably want to change the condition into an array).
Sorry for the silly question but, How do I do that? I need to start somewhere I have no idea how to do plugins yet, I just have a vague understanding of the code itself at this point but definitely want to learn.
Reply With Quote
  #6  
Old 01-27-2013, 06:36 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="http://www.vbulletin.com/docs/html/plugin_system?manualversion=40200603" target="_blank">http://www.vbulletin.com/docs/html/p...rsion=40200603</a>
Reply With Quote
  #7  
Old 02-17-2013, 02:02 PM
ringnews24's Avatar
ringnews24 ringnews24 is offline
 
Join Date: Aug 2012
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any modules that do this yet?

Can you explain more?

--------------- Added [DATE]1361113915[/DATE] at [TIME]1361113915[/TIME] ---------------

Quote:
Originally Posted by Lynne View Post
I think you want a plugin, not a template edit.

hook - forumdisplay_start
php code
PHP Code:
if ($foruminfo['forumid'] == x) {
$vbulletin->options['maxthreads'] = "10";

Change x to the forumid
Lynne, I wanted to add thread limit to several different sections how do I do that?

Do I need to need to make more than one plug in?
Reply With Quote
  #8  
Old 02-17-2013, 03:36 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just use an array.

PHP Code:
if (in_array($foruminfo['forumid'], array(x,y,z))) {
$vbulletin->options['maxthreads'] = "5";

Replace x,y,z with the forumids.
Reply With Quote
  #9  
Old 02-17-2013, 04:11 PM
ringnews24's Avatar
ringnews24 ringnews24 is offline
 
Join Date: Aug 2012
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Say I wanted to make world boxing 20 threads and british boxing 10 threads how do I do that?

Is that possbile?
Reply With Quote
  #10  
Old 02-17-2013, 04:37 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just put each condition into the same plugin.

PHP Code:
if ($foruminfo['forumid'] == x) { 
$vbulletin->options['maxthreads'] = "10"

if (
$foruminfo['forumid'] == y) { 
$vbulletin->options['maxthreads'] = "5"

Reply With Quote
Благодарность от:
ringnews24
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 07:28 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.11359 seconds
  • Memory Usage 2,274KB
  • Queries Executed 13 (?)
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)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete