The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hi:
I'm in the midst of developing a custom hack for a website I run (to integrate a fantasy game they're running with various elements of vBulletin). I need to create a plug-in that will automatically change a "yesno" setting I've created in vBulletin Options after a certain time has passed. I know how I'm going to write the plug-in; what I *don't* know is which hook location to place it in. Any suggestions? |
|
#2
|
||||
|
||||
|
global_start
|
|
#3
|
|||
|
|||
|
Thanks for the help.
It turns out I was a little mistaken about how to write the plugin. It currently looks something like this: Code:
// Get current time and deadline.
$now = time();
$then = explode(',',$vbulletin->options['fantasygame_closingtime']);
$deadline = mktime($then[3], $then[4], 0, $then[0], $then[1], $then[2]);
// If the deadline has passed, update the setting.
if ($now >= $deadline) {
$db->query_write("UPDATE setting SET value = 0 WHERE varname = 'fantasygame_picksactive'");
}
I'm guessing there's something else I have to do... any ideas what it is? |
|
#4
|
||||
|
||||
|
You have to call build_options() to rebuild the cache when you've changed a setting.
I though you just wanted to change it at runtime. |
|
#5
|
|||
|
|||
|
Quote:
My attempts to do so resulted in my boards crashing with a function undefined error, and I had to go into phpMyAdmin and edit it out of the plugin table and the datastore manually. |
|
#6
|
||||
|
||||
|
build_options() is defined in includes/adminfunctions.php.
Though, you really should not change settings too often. As far as I understand the above code, it updates the setting on every pageload when the time has passed ... |
|
#7
|
|||
|
|||
|
Quote:
Quote:
|
|
#8
|
||||
|
||||
|
The hook location is fine, you just need that file.
|
|
#9
|
|||
|
|||
|
I have that file, and it has the function in it. So why would I get this type of an error message, then?
Quote:
|
|
#10
|
||||
|
||||
|
Because you don't use it
![]() PHP Code:
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|