PDA

View Full Version : Problem with adding code to the footer.


vsforums
01-07-2013, 08:21 PM
Hi,

I want to add some javascript code to the footer of the first page after user login(vb 4.1).
I tried to use login_redirect hook but this code unfortunately doesn't work because templatecache is empty at that time?
$vbulletin->templatecache["STANDARD_REDIRECT"] = str_replace('</body>', 'mycode</body>', $vbulletin->templatecache["STANDARD_REDIRECT"]);

Any idea?

kh99
01-07-2013, 09:45 PM
The templates don't get cached until the first template is created. But you could do something like this:

global $bootstrap;

if (!empty($bootstrap) AND !$bootstrap->called('template'))
{
$bootstrap->process_templates();
}

// the rest of your code here

vsforums
01-09-2013, 01:19 PM
Thanks!!! It worked!!!