View Full Version : How can I change product's settings via code?
SToP_GAP
09-30-2012, 10:38 PM
I'm really stumped... I have set up a product, with plugins etc. and have assigned an options group and options.
I can read the options using $vbulletin->options['option_name'] just fine.
What I can't work out is how to write to the options by name via PHP. If possible I need to do this from anywhere rather than just via a specific hook... can anyone help?
You can update the settings table in the database, then call the function build_options() (which is in includes/adminfunctions.php) Here's a thread where it was discussed: www.vbulletin.org/forum/showthread.php?t=268937
SToP_GAP
10-01-2012, 05:00 PM
That's fantastic, thanks very much :) I searched for such a long time trying to find an answer on this, it really is quite difficult to find the documentation for VBulletin development sometimes, I've really struggled as an experienced PHP programmer and web developer with VB.
Yeah, searching is tough, I just happened to remember someone asking about it. And yeah, I always tell people who want to learn how to make vb mods that unfortunately the only good way (IMHO) is to start looking through the code and learning how it works.
SToP_GAP
10-01-2012, 05:34 PM
Indeed, it's what I've been doing on the whole - it's very frustrating at times, makes me feel like I don't know anything XD It is not helped at the moment by the online API docs not loading, I've submitted a ticket to VB and they're dealing with it... slowly!
--------------- Added 1349132986 at 1349132986 ---------------
Perhaps you can help with one more query... I want to store a few bits of information in the settings for my product which are readonly from the admin panel.
I see where to change the output in the setting option definitions, I'm just not sure what I should enter there to achieve READONLY input fields... Any ideas?
Thanks again for your assistance so far, you've saved me so much time!! :D
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.