PDA

View Full Version : Fed up! Why isn't this working? $vbulletin->options['hiddensigson']


BirdOPrey5
07-20-2010, 02:08 AM
OK I made a new option, var name: hiddensigon
yesno type
default: 0
I double checked all the settings from a working mod and they are indentical besides the var name...

Then in my plugin I use an if statement:

if ($vbulletin->options['hiddensigson'])
{
//code
}

But even when I turn the option to "Yes" it never executes the code... when I try to output the variable just to see what it is, I get nothing at all... $vbulletin->options['hiddensigson'] resolves to nothing...

can't figure out what is wrong.:confused:

Guest190829
07-20-2010, 02:14 AM
But output, do you mean a proper var_dump() or are you just echoing it? If the latter, try the former. This is most likely a scope issue, what hook are you using?

BirdOPrey5
07-20-2010, 10:46 AM
postbit_display_start

and I was just adding it on to the end of a template... I just added it like ".$hiddensigon" I tried ".'test'" and "test" showed up so the value of "$hiddensigon" should also show.

I'm guessing it's a scope issue too... do I need to include something then?

kh99
07-20-2010, 01:18 PM
You probably need to add "global $vbulletin;" before your code. I think that's what Danny was thinking.

borbole
07-20-2010, 01:35 PM
If the globalizing of $vbulletin won''t either, then try to use $this->registry->options['hiddensigson']

BirdOPrey5
07-20-2010, 01:39 PM
thanks, (global $vbulletin;) that did it... is there any way to know ahead of time if that line is needed depending on the hook b/c the working mod I looked at didn't need it for the hook it used.

kh99
07-20-2010, 01:47 PM
As far as I know, the only way is to look at the source code. For instance if you look at includes/class_postbit.php around line 265 you can see where the postbit_display_start
hook is called.

BirdOPrey5
07-20-2010, 01:56 PM
thnx.