vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Change Number of Threads per Page (SPECIFIC FORUM) (https://vborg.vbsupport.ru/showthread.php?t=294410)

addamroy 01-26-2013 12:32 PM

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?

Lynne 01-26-2013 06:34 PM

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

addamroy 01-26-2013 09:25 PM

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

Lynne 01-27-2013 03:07 AM

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).

addamroy 01-27-2013 05:16 AM

Quote:

Originally Posted by Lynne (Post 2399791)
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.

Lynne 01-27-2013 06:36 PM

<a href="http://www.vbulletin.com/docs/html/plugin_system?manualversion=40200603" target="_blank">http://www.vbulletin.com/docs/html/p...rsion=40200603</a>

ringnews24 02-17-2013 02:02 PM

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 (Post 2399709)
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?

Lynne 02-17-2013 03:36 PM

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.

ringnews24 02-17-2013 04:11 PM

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

Is that possbile?

Lynne 02-17-2013 04:37 PM

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"




All times are GMT. The time now is 12:22 AM.

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.01504 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete