PDA

View Full Version : New product $vbulletin->options problem


JamesAB
01-24-2009, 04:05 AM
I added a product and I'm trying to add a conditional to a plugin. My code runs fine without the conditional, but never runs (regardless of the settings chosen) with the conditional.

Here's the product options:
<options>
<settinggroup name="jab_static_thumbnails" displayorder="1">
<setting varname="static_thumbnails_enabled" displayorder="60">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>1</defaultvalue>
</setting>
</settinggroup>
</options>

Here's what I have in the attachdata_postsave hook:
if ($vbulletin->options['static_thumbnails_enabled'])
{
//MY CODE
}

Any ideas why $vbulletin->options['static_thumbnails_enabled'] isn't being set, so I can use it here?

Thanks,
James

Lynne
01-24-2009, 04:12 AM
Try $this->registry->options['static_thumbnails_enabled']

JamesAB
01-24-2009, 05:34 AM
That works for me now.:)

Thank you very much Lynne.

Marco van Herwaarden
01-24-2009, 02:56 PM
And i strongly recommend to prefix your settings.

Not:
'static_thumbnails_enabled'

But:
'jab_static_thumbnails_enabled'

This will avoid any future problems like an identical named setting added to default vB in a later version.