PDA

View Full Version : Variable Declared in a Plugin Not Initialized in Error Pages


lordfkiller
01-16-2008, 08:14 AM
Hello.

I have created a plugin for global_start hook with execution order of 5.

ob_start();
$sth_currentloc_enc = urlencode('http://forums.domain.com'.$_SERVER['REQUEST_URI']);
ob_end_clean();

As you can see, it declares and initializes a variable called $sth_currentloc_enc which contains URL-encoded URL of current page.
The problem is that in error pages, the variable is not set(returns ""). Though it works well in other pages like home page etc.

Any help is kindly appreciated.

jaffar_t
01-16-2008, 09:08 AM
I have the same problem,

Please help...

Opserty
01-16-2008, 11:15 AM
You don't need line 1 or line 3 in your code. Although I don't if that will fix your problem.

You may need to use the $GLOBALS array to access the variable. Try using this code where you would normally just use the variable.

$GLOBALS['sth_currentloc_enc']

P.S. In most of default vBulletin pages you can make use of the THIS_SCRIPT constant to find the filename.

lordfkiller
01-16-2008, 11:43 AM
It worked! Thank you.