The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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); 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. |
#2
|
||||
|
||||
<a href="https://vborg.vbsupport.ru/showthread.php?t=116370" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=116370</a>
|
#3
|
|||
|
|||
Quote:
|
#4
|
|||
|
|||
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. |
#5
|
||||
|
||||
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 )
|
#6
|
|||
|
|||
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. |
#7
|
|||
|
|||
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! |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|