PDA

View Full Version : Postbit or showthread hook location


Mickie D
10-14-2012, 05:22 PM
Hi all,

Looking for the right hook for my code.

Basically I am calling information from a forum field which is dependant on forumid.

But when I associate my code to hook location postbit complete it breaks the site.

But when I try and use showthread complete it does not show up... but does not break the forum


here is the code -- thanks very much for looking.


// Call Mysql Data from forum table
$results = $vbulletin->db->query_read("SELECT ultimate_ads FROM ".TABLE_PREFIX."forum WHERE forumid = $forumid");

// Put Mysql data in an array
$advert_code_last = mysql_fetch_row($results);

// Pull the data relevant to the forumid
$advert_code_last = $advert_code_last[0];

// If a Advert has not been assigned - give it a default advert
if ($advert_code_last == ''){
$advert_code_last = 'DEFAULT ADVERT CODE TO GO HERE';
}

// Register the Variable in the navbar template for use
vB_Template::preRegister('navbar',array('advert_co de_last' => $advert_code_last));

kh99
10-14-2012, 05:29 PM
If you're trying to add one banner to the navbar then you'd want to use hook parse_templates.

I think the reason that the site breaks when using a postbit hook is because you'd need "global $vbulletin;" at the beginning of the code (but like I mentioned above, it wouldn't work there anyway).

Mickie D
10-14-2012, 06:24 PM
oh crap lol.

Its not for the navbar!

It's actually for the postbit legacy template!!!

I noticed I never updated the preregister part of the code :(

Thanks KH99