PDA

View Full Version : variable in hook and template with standard_error


nquang
04-17-2011, 09:13 AM
Hi all,

I edit file "newthread.php" and add this code if ($vbulletin->userinfo['userid'] != 1) {
eval(standard_error('You are not administrator!'));
}
after if (!$foruminfo['allowposting'] OR $foruminfo['link'] OR !$foruminfo['cancontainthreads'])
{
eval(standard_error(fetch_error('forumclosed')));
}

I create a plugin at hook "cache_templates" $zxzxzx = 123456789;

and i call $zxzxzx in template "navbar" Number $number

When i visit my forum. If userid = 1, Number 123456789 is show. But i userid != 1, it not show $number and only show "Number ".

How to fix it? I want value of $number show in template.

Thanks you.

kh99
04-17-2011, 12:21 PM
I believe the problem is that when userid != 1, you show the standard error page, and in function standard_error() (in includes/functions.php) evaluates the navbar template, but at that point $number is not available because it is global.

Maybe it will work if you use an existing global array instead of $number, like $template_hook['number'] or $vbulletin->userinfo['number'].

nquang
04-18-2011, 04:03 AM
I will try your solution today and reply :D

Thank you very much!