Back to vBulletin 3.0 Template Modifications

Allow users to show/hide sub forums
Mod Version: 1.00, by Brent H

This modification is in the archives.
vB Version: 3.0.7 Rating: (0 vote - 0 average) Installs: 1
Released: 24 Jul 2005 Last Update: Never Downloads: 8
Not Supported Template Edits  

I help run a forum that has a lot of sub forums, and since they're displayed on the main page they take up quite a bit of screen space. In order to save me a bit of scrolling, I popped this little option in to the User CP and everyone seems to think it's great.

What this does is allow users to choose whether or not sub forums get displayed on the main page of the forum. Pretty useful if you have people who like having everything on one page, and people who think less is more and prefer a cleaner main page.

Here's how to do it:

1- In your AdminCP, select User Profile Fields >> Add New User Profile Field. Choose “Single Selection Radio Buttons” as the profile field type and hit “Continue”

2- Use these values in the following fields:

User Profile Field
Title: Display Subforums?
Description: Changing this option will show/hide the subforums on the main page.
Options: Yes, No (each option is on a different line!)
Set Default: Yes
Field Required: No
Field Editable By User: Yes
Private Field: Yes
Field Searchable on Members List: No
Show on Members List: No


Optional Input
Allow user to input their own value for this option: No

Display Page
Which page displays this option: Options: Thread Viewing
3- Hit “Save”, and you’ll be taken to the User Profile Field Manager. Take note of what the field ID for your new option is… In my case, it’s “field7”

4- Go to Styles & Templates >> Style Manager and choose “Edit Templates” on whatever forum style you want this to apply to.

5- In the Style Manager for your template, choose PHP Include Code Templates >> phpinclude_start

6- At the very top of your template, paste the following code:
PHP Code:
if ($bbuserinfo['field7'] == 'No')
{
$vboptions['subforumdepth'] = 0;

Note that ‘field7’ needs to be replaced with whatever number your new User Profile Field Option is!

7- Click save, and you’re done!

============================================

This template modification assumes that your subforum depth is set to 1 by default. If your subforums are set to 0, do the following:

1- Instead of:
Yes
No
in your User Profile Field Options, make it:
No
Yes
2- Use this bit of code in your phpinclude_start template instead of the one used above:
PHP Code:
if ($bbuserinfo['field7'] == 'Yes')
{
$vboptions['subforumdepth'] = 1;

Remember to replace ‘field7’ with whatever yours is!
Not hard at all Enjoy!

Download

This modification is archived and cannot be downloaded.

Similar Mods

Show/Hide Private Forums vBulletin 3.5 Add-ons

vblts.ru supports vBulletin®, 2022-2024