Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Template Modifications
Allow users to show/hide sub forums Details »»
Allow users to show/hide sub forums
Version: 1.00, by Brent H Brent H is offline
Developer Last Online: Feb 2008 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 07-23-2005 Last Update: Never Installs: 1
Template Edits
 
No support by the author.

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:

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

Quote:
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:
Quote:
Yes
No
in your User Profile Field Options, make it:
Quote:
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!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 07-24-2005, 05:20 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for sharing your work with us.
Reply With Quote
  #3  
Old 07-24-2005, 06:19 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's very clever.
Reply With Quote
  #4  
Old 07-24-2005, 07:24 PM
Brent H's Avatar
Brent H Brent H is offline
 
Join Date: Sep 2004
Location: Phoenix, AZ
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Glad you like it It's small, but useful.
Reply With Quote
  #5  
Old 08-01-2005, 06:24 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is it possible or does it already make it so that upon new registrations the subforums display is turned off by default?
Reply With Quote
Reply

Thread Tools

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 11:54 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.07495 seconds
  • Memory Usage 2,244KB
  • Queries Executed 18 (?)
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
  • (2)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_onlinestatus
  • (5)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete