PDA

View Full Version : Change Number of Threads per Page (SPECIFIC FORUM)


addamroy
01-26-2013, 12:32 PM
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)
<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
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
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 1361113915 at 1361113915 ---------------

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

hook - forumdisplay_start
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.

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.

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

ringnews24
02-17-2013, 05:08 PM
Thanks Lynne

jind
04-03-2013, 05:01 PM
Enhanced code is

if (in_array($foruminfo['forumid'], array(65,66,67,68,69,70,71,72,73,74,75,76,77,78,79 ,80,81,82,83))) {
$vbulletin->options['maxthreads'] = "500";
}