PDA

View Full Version : Saving to Vbulletin Options with Plugins


kau
04-21-2009, 07:25 PM
I have created an input box for my plugin

I can access the data that is saved into the vbulletin options from it like this:

$maincatid=$parser->registry->options['awesome_reviews_maincatid']

how can I save something to it manually?

Lynne
04-21-2009, 08:00 PM
I'm pretty sure all options are saved in the settings table. You may want to look through the code used in saving the options in the admin cp to see if there is datamanager or what method is used there.

kau
04-21-2009, 08:53 PM
here's kind of what i have been doing

$admindm =& datamanager_init('Admin', $vbulletin, ERRTYPE_CP);
//$admindm->set_existing($variable_array);
$admindm->validfields['awesome_reviews_maincatid'] = array(TYPE_STR, REQ_NO);
$admindm->set('awesome_reviews_maincatid', '6');
$admindm->save();

This freezes up at the set() part

I don't think datamanager has a section for the vbulletion options does it?.......

Lynne
04-21-2009, 11:35 PM
Taking a quick look at options.php and the dooptions section, it calls the funtion save_settings. If you take a look at that, it looks like it just does the query. Perhaps you can reuse that code.

Dismounted
04-22-2009, 07:05 AM
I have a question - why are you setting vBulletin settings outside of the Admin CP? This could potentially compromise security.

kau
04-22-2009, 02:14 PM
Thx Lynne, when I first did my database dump I only saw that varname in datastore for some reason :) Now I see the setting