View Full Version : Plugin COnditional
dartho
10-02-2008, 03:42 AM
Why would $vbulletin->options['product_setting'] not evaluate in a plugin, but $GLOBALS['vbulletin']->options['product_setting'] does evaluate?
I thought they were the same, and that all $vbulletin->options[] is available for use in plugins?
Many thanks
Dismounted
10-02-2008, 05:00 AM
$vbulletin is not available in the local scope of where that hook is located. I suggest you have a read about variable scope, the PHP manual is pretty good (http://www.php.net/manual/en/language.variables.scope.php).
Depending on the hook location, inside class objects, you will usually be able to access the variable through $this->registry->options.
dartho
10-02-2008, 05:58 AM
I'm actually wanting to add a setting to a product so an admin can choose whether or not to display information in the postbit.
I'm trying to check the value of this option in a plugin on the postbit_display_complete hook.
Dismounted
10-02-2008, 06:12 AM
My post still applies.
dartho
10-02-2008, 06:23 AM
That it does - I was just supplying more information.
Your suggestion of $this->registry->options['product_setting'] does indeed work as suggested. Many thanks!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.