I have created a product and in that product everything works right. The only issue I am having is pre-registering a variable for my header template.
PHP Code:
include("./includes/class_twbr.php");
$defaultdir = str_replace(".", "", $vbulletin->options['twbr_default_dir']);
$rotaterid = 1;
$forumid = $foruminfo[forumid];
$show_banners = false;
if($forumid > 0) {
$twbr = new TWBR($vbulletin);
$twbr->twbr_set($defaultdir, $rotaterid, $forumid);
$twbr->twbr_forum_query();
$banner_query = $twbr->twbr_banner_query();
$rotater_query = $twbr->twbr_rotater_query();
$rotater = $vbulletin->db->fetch_array($rotater_query);
$rotater_delay = 1000 * $rotater['delay'];
$rotater_bits = array("id" => $rotater['id'], "title" => $rotater['title'], "width" => $rotater['width'], "height" => $rotater['height'], "bgcolor" => $rotater['bgcolor'], "delay" => $rotater_delay);
$banner_bits = array();
$banner_count = 0;
while($banners = $vbulletin->db->fetch_array($banner_query)) {
$banner_bits[$banner_count]["count"] = $banner_count;
$banner_bits[$banner_count]["id"] = $banners["id"];
$banner_bits[$banner_count]["name"] = $banners["name"];
$banner_bits[$banner_count]["imageurl"] = $vbulletin->options['bburl'].urldecode($banners["imageurl"]);
$banner_bits[$banner_count]["link"] = urldecode($banners["link"]);
$banner_bits[$banner_count]["desc"] = $banners["desc"];
$banner_count++;
$show_banners = true;
}
$templater = vB_Template::create('twbr_bits');
$templater->register('banner_bits', $banner_bits);
$templater->register('rotater_bits', $rotater_bits);
$twbr_bits = $templater->render();
vB_Template::preRegister('header',array('twbr_bits' => $twbr_bits));
}
Everything here works except the vB_Template:
reRegister. The variable does get populated. I can see the data if I dump it.
I have tried many different plugin hook locations. I have tried the globals, the forumdisplays, I also tried parse_templates, but nothing seems to work, and it seems to just be with pre-registering for header, because I changed it to navbar and it worked, so I am a bit confused.