The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Add options per forum
What this is This guide will teach you to use the hooks system to add options to your admincp/forum.php page. One finished, you will be able to add new options to your forum with just a few lines of code. Don't understand? Ever wanted to turn something on, but only in one of your forums? For example, lets say you want to execute code, but only in forum I.D. 2, 16, and 45. Lets begin! In this tutorial we will assume that you want a yes or no option; in order to enable/disable some code. In order to do that we first need to create a new row in the database. This will hold the information of which forums will be enabled/disabled. Always remember that '1' is considered as on, or enabled. And that '0' is considered off, or disabled. Please make sure this is all done on a test forum! We have to store the data! Run this SQL Query: [sql] ALTER TABLE forum ADD ( var smallint(3) unsigned not null default '' ) [/sql] Var = The name of the row in the database. This should be a name that will describe your system in one word. For example. In my vB Category Icons hack. This row is named 'forumhomeicon' Now that we have added our new row named 'var'. We now have to add the on/off option in the forums manager area of the admin control panel. Add the option in the ACP To add this new option in the ACP we need to create a new hook and add some code to that hook. The hook name should be: forumadmin_edit_form And the code should be: PHP Code:
That will actually add the yes/no row to all your forums in the admincp. So when you click on the save button, it will add your selection to the database. But how does it know which row to add it to? Glad you asked. You have to create one more hook! The hook name should be: forumdata_start And the code to add there is the following PHP Code:
I want to add more then just one option! Then you will need to repeat this tutorial for each option you would like to have. Now that you have saved both hooks. You can now use the following code in any of your hooks. PHP Code:
HTML Code:
<if condition="$foruminfo['var'] == 1"> <!-- Your Code Here --> </if> If you have 2 or more options being added to the forums, you can place all the code in each hook. For example: Hookname: forumadmin_edit_form Code: PHP Code:
Code: PHP Code:
Custom Fields The following fields can also be used. PHP Code:
PHP Code:
PHP Code:
This tutorial was created for a member who needed to know how to do this exact thing, so I figured I would teach everyone. |
#32
|
|||
|
|||
Quote:
Here are the details: I was trying to figure out how I can allow a registered user to add a new "Forum Topic" in my implementation of vBulletin. What I saw was one can add Forums through the Admin Control Panel and mark them either as Categories or Forums. My requirement was, under special situations, I would like registered users to add a Forum Topic, and the admin will then approve the forum to be active. After some study of the documentation and admin code, i was able to figure out how to achieve that using "Datamanager". The code I have posted earlier does what I wanted. Is this the correct approach? This is similar to adding a User using "Datamanager" as given in one of the examples. I was worried when you mentioned Quote:
|
#33
|
|||
|
|||
As long as it will not allow members to create their own forums and make them look/access them like a standalone board, you will not be breaking the license agreement. Otherwise yes.
|
#34
|
|||
|
|||
Thanks your reply...
Do you mean "standalone forum" as in a separate implementation of vBulletin software?... that isn't the intention. These will be part of one single implementation and each of the forum topics will have to be approved by the Admin. The Admin might choose to appoint the user who created the forum as its Moderator. I hope thats in line with the agreement. |
#35
|
||||
|
||||
Just wanted to say thanks, Live Wire. Your tut was just what I needed and really helped cutting down on time I probably would have needed without it. Very helpful indeed!
|
#36
|
|||
|
|||
FYI, if anyone is interested in a hack that makes it easy to add custom forum permissions (which match up with a set of custom usergroup permissions), check out my hack at:Custom Usergroup Forum Permissions
Livewire, this thread was very useful to me. I'm hoping to incorporate custom forum options into my hack as well, which will provide the ultimate in permissioning... custom forum permissions-> custom usergroup permissions -> custom forum permissions. |
#37
|
|||
|
|||
Glad you found this turorial useful
|
#38
|
|||
|
|||
I am having some trouble with this.
I have done everything to-the-letter, but the custom option (which is the [you] hack) is still being allowed across the board. Is this a function of the [you] hack, or is there something I am missing in these instructions? I seem to only be able to turn the [you] hack on/off by changing the php code here (from 1 to 0) (this is how I have the [you] hack configured on my site after following the instructions) PHP Code:
here is what I used in the forumadmin_edit_forum hook: PHP Code:
|
#39
|
|||
|
|||
-bump-
....any help? |
#40
|
|||
|
|||
This:
PHP Code:
PHP Code:
|
#41
|
|||
|
|||
Why you want to use a input_row for a yes/no value?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|