vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do you add extra per-forum setting fields? (https://vborg.vbsupport.ru/showthread.php?t=158771)

Cars2007 09-25-2007 11:31 PM

How do you add extra per-forum setting fields?
 
I would like to add a couple of per-forum settings that can be modified in the forum editor. I've already added the fields to the forum table. I know you have to hook forumadmin_edit_form to do this, but I'm not sure how to wire it up so that it actually loads & saves the fields from/to the forum table.

I also don't know how to get the field to show up in the $foruminfo array. I am looking at forumdisplay.php and seeing an array called $foruminfo, but when I print the contents of the array (print_r) I see a whole lot of fields - but not the two I added to the database. I looked up the datamanager documentation, and added this to the forumdata_start hook:
Code:

$this->validfields['thread_title_open_tag'] = array(TYPE_NOTRIM, REQ_NO);
$this->validfields['thread_title_close_tag'] = array(TYPE_NOTRIM, REQ_NO);

Yet, print_r-ing the $foruminfo array reveals the fields are NOT showing up.

I've spent a good deal of time searching for this info, and I've found a few useful pieces of information, but feel like there must be some kind of "starting point" that I'm missing. Is there some kind of walkthrough for doing all this? Otherwise, help on the above would be greatly appreciated.

Dismounted 09-26-2007 07:08 AM

<a href="https://vborg.vbsupport.ru/showthread.php?t=116370" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=116370</a>

Cars2007 09-26-2007 05:30 PM

Quote:

Originally Posted by Dismounted (Post 1347311)

That is a good start, thanks. I am wondering how I might adapt that to store strings rather than bitfields. A lot of the code in there seems specific to bitfields.

Marco van Herwaarden 09-27-2007 08:02 AM

To add a string setting to the forum options, you would basicly need to do the following:
- Add column to the "forum" table. (add in install code, remove in uninstall code of the product)
- Create plugins to: Add a default (when adding a new forum, this could be skipped), Add the field to the edit page & add the column to the validfields.
- Create the phrases to use when editing the page

For a basic example, see this modification: Direct External Links
You will find all you need in there, without much extra stuff that could confuse things. ;)

Dismounted 09-27-2007 11:43 AM

Also, make sure you prefix the fields you add to the database. (I don't know why Marco didn't mention this, as he's the one that taught me to do that ;))

Marco van Herwaarden 09-27-2007 01:11 PM

Hehe,

Prefixing custom columns (or tables) is a way to make sure that you would not run into conflicts with any future vB version that might use a column with the same name.

Cars2007 09-28-2007 12:07 AM

Thanks for the help, guys. I was able to figure it out already, but I went ahead and prefixed the columns like you said. Good idea.

I added plugins for forumadmin_edit_form, forumadmin_update_save, forumdata_start, and forumdisplay_complete. Works like a charm. The plugin system in vBulletin is great!


All times are GMT. The time now is 07:52 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.01026 seconds
  • Memory Usage 1,726KB
  • 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
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete