Log in

View Full Version : Hook & Variable Question


kirstyd
08-23-2007, 11:09 AM
I feel like I'm missing something *very* obvious here.

I have some extra user variables I want to be able to access from any page on the site, so I'm trying to set them in the global_start hook on v3.6.5. But no matter what I do I can't see the variables later on.

E.g. if I just add a very basic plugin on the global_start hook:

global $myvariable;
$myvariable = "boo!";

then later on my vbulletin page $myvariable is not set.

Any ideas?

thanks
kirsty

SDB
08-23-2007, 12:41 PM
Hi Kirsty

I've had this happen a number of times and muddled through until i've sorted it.

Which template are you trying to access the variable from?

Try accessing it from a really basic template like header first.

Paul M
08-23-2007, 04:18 PM
Where [later on] are you trying to use it ?

kirstyd
08-24-2007, 08:35 AM
I got it all to work in the end.

I think it wasn't working because one of the lines I'd commented out hadn't been fully commented out so there was half a line of PHP causing an error, which just seemed to stop the hook from being run whilst everything else carried on regardless. I knew it would end up being something silly.

If this should have produced an error message somewhere let me know so I'll know next time :D

thanks
kirsty