The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Change Default vB Settings via Custom Mod
Hi,
Is it possible to create a new modification and use it to change settings that come in default vB? For example: If I create a mod for "Who has read a thread" that changes the CSS style etc, is it possible to enable/disable the "Who has read a thread" via this new mod without making new tables etc? If so, how would I go about it? |
#2
|
|||
|
|||
If I understand what you're asking, then yes, you can usually change vb settings in a plugin by resetting the value, if your plugin is at a hook location that gets called before the value is used. The settings values are in $vbulletin->options['setting_name']. You have to know 'setting_name' for the setting you want to change, of course. You can figure that out by looking at the code where it's used, or by hovering your cursor over the value in the admincp (I think you need to have the site in debug mode for that to work). You can also look at the html source for the settings page in the admin cp, if all else fails.
|
#3
|
|||
|
|||
Thanks for the reply. It's not a plugin I want to do it with (I don't think). When you go to admincp>options>settings, turn board on/off, there is an select option to turn the board online/offline. Is it possible to create an addon with that exact setting in it so I can turn the board on/off via my new mod in settings?
|
#4
|
|||
|
|||
No, you wouldn't be able to add that exact setting to your mod. But you could add a setting to your mod and use the same text as the vb setting so that it looks the same, then write a plugin that changes the vb setting depending on your mod's setting.
But maybe I still don't understand, because I don't see why you'd want your mod to have the same setting as one of the vb settings. |
#5
|
|||
|
|||
There are some mods available that require certain settings to be enabled or disabled for the mod to work. For Example:
If I wanted to change how reputation was shown on postbit_legacy but I had the rep system turned off. I wanted to be able to make a mod with various options. Therefore I would have to enable the new rep mod, then go to the rep settings and enable the rep system. I want to be able to turn it on/off and change my custom settings on the same page. |
#6
|
|||
|
|||
OK, fair enough. What I mentioned above would actually be a way to override the default vb setting. If you want a setting that would mirror the vb setting (so that no matter which one the user changed, the other would change also), then I think it could be done but you need a plugin that runs when the settings are changed. If that's what you want, I don't know offhand how to do that but I think, Ozzy47 does.
|
#7
|
|||
|
|||
OK thanks. I see the variable for turning the board on/off is:
Code:
$vbulletin->options['bbactive'] |
#8
|
|||
|
|||
In general I think it calls save_settings(), which is in includes/adminfunctions_options.php. If you were writing your own code to change the setting, you could just update the value in the settings table in the db, then call build_options(). If you want to do it in response to one of your mod options begin changed, then you need a plugin, maybe on one of the hooks in that function, I'm not sure.
I'd figure it out, but like I mentioned I believe Ozzy was just talking about something like this so I think he'll know off the top of his head. |
#9
|
|||
|
|||
So I could just create a plugin and run an UPDATE sql command to change the setting from on to off and vice versa?
|
#10
|
|||
|
|||
Right. I haven't tried it, but I think you can use the save_settings() function like this:
Code:
include_once("includes/adminfunctions.php"); include_once("includes/adminfunctions_options.php"); save_settings(array('bbactive' => 0)); Edit: On second thought, I'm not really very familiar with install code. It might be that wouldn't want to do it that way because build_options() might already get called when a product is installed. If that is what you want to do, I could check the product install code and see (unless someone else happens to know) |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|