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. |
#22
|
||||
|
||||
Quote:
|
#23
|
|||
|
|||
Thank you so much for this tutorial. I found it very helpful!
Rebecca |
#24
|
|||
|
|||
Hi everyone,
i am new to this but i like know how to add the following pages to my site. home --><--forum---><--Link Page--> <--Resources--><--etc--> How do I go about doing just that? Any help would be appreciated. |
#25
|
|||
|
|||
Hi Everyone,
Can some help me please? |
#26
|
|||
|
|||
I want to make make it so when users post in my graphic forum, it has a drop down below the title were it will say Experience: and they can choose from noobie or pro or basic and then it will add it to the title... (ie they put pro as thier graphic experience) so it would say something like this in the title- Check out this new design!!![PRO]
|
#27
|
|||
|
|||
Dude, this is vBulletin 3.5, and the stuff in this tutorial could be done via XML...
HINT: <group name="misc"><group name="forumoptions">...</group></group> |
#28
|
|||
|
|||
How do I allow end users to ADD A NEW FORUM? By end users, I mean, registered users who are neither administrators, nor moderators. I am trying to look for a complete example using vB_DataManager_Forum.
|
#29
|
|||
|
|||
Could you please try to explain what you want to achieve. This sounds like it is getting very close to the borders of the license agreement.
|
#30
|
|||
|
|||
Quote:
By the way, I figured it out: Code:
$forum = array( 'title' => 'My Forum Topic, 'description' => '', 'link' => '', 'displayorder' => 1, 'daysprune' => -1, 'parentid' => 1, 'newthreademail' => '', 'newpostemail' => '', 'options' => array( 'moderatenewpost' => 0, 'moderatenewthread' => 0, 'moderateattach' => 0, 'warnall' => 0, 'styleoverride' => 0, 'canhavepassword' => 1, 'cancontainthreads' => 0, 'active' => 1, 'allowposting' => 0, 'indexposts' => 0, 'allowhtml' => 0, 'allowbbcode' => 1, 'allowimages' => 1, 'allowsmilies' => 1, 'allowicons' => 1, 'allowratings' => 0, 'countposts' => 0, 'showonforumjump' => 1), 'styleid' => -1, 'password' => '', ); $forumdata =& datamanager_init('Forum', $vbulletin, ERRTYPE_CP); foreach ($forum AS $varname => $value) { if ($varname == 'options') { foreach ($value AS $key => $val) { $forumdata->set_bitfield('options', $key, $val); } } else { $forumdata->set($varname, $value); } } $forumid = $forumdata->save(); |
#31
|
|||
|
|||
Yes that question was for you, but since you didn't answer what you want to achieve, i can also not anwer if it is a violation of the user agreement.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|