wottech
12-21-2008, 03:22 PM
I wrote a plugin for a garage module to provide a link from the postbit back to the user's garage. It works fine in 3.7.3, but does not work in 3.7.4. Was there a change in template conditional or something in 3.7.4 that would cause it not to work? See the plugin code as well as the template code below..
if(THIS_SCRIPT == 'showpost' OR THIS_SCRIPT == 'showthread')
{
switch ($vbulletin->options['postbittype'])
{
case 1: $pbq = "ORDER BY `main_vehicle` DESC LIMIT 1"; break;
case 2: $pbq = "ORDER BY `main_vehicle` DESC LIMIT 1"; break;
case 3: $pbq = "ORDER BY `vehicle_id` DESC LIMIT 10"; break;
}
$sql = $this->registry->db->query("select *, " . TABLE_PREFIX . "garage_user_vehicle.user_id AS PostUser
from " . TABLE_PREFIX . "garage_user_vehicle
LEFT JOIN " .TABLE_PREFIX . "garage_makes
on (" .TABLE_PREFIX . "garage_user_vehicle.make_id=" .TABLE_PREFIX . "garage_makes.id)
LEFT JOIN " .TABLE_PREFIX . "garage_models
on (" .TABLE_PREFIX . "garage_user_vehicle.model_id=" .TABLE_PREFIX . "garage_models.id)
WHERE " . TABLE_PREFIX . "garage_user_vehicle.user_id='" . $post['userid'] ."' " . $pbq);
if($this->registry->db->num_rows($sql) > 0)
{
if($vbulletin->options['postbittype'] >= 3)
{
while ($entry = $this->registry->db->fetch_array($sql))
{
$newyr = substr($entry[made_year], -2);
eval('$template_hook[\'postbit_userinfo_right_after_posts\'] .= "' . fetch_template('postbit_garagelink') . '";');
}
} else {
$entry = $this->registry->db->fetch_array($sql);
$newyr = substr($entry[made_year], -2);
eval('$template_hook[\'postbit_userinfo_right_after_posts\'] .= "' . fetch_template('postbit_garagelink') . '";');
}
}
}
<if condition="$vbulletin->options['postbittype'] == 1">
<div><a href="garage.php?do=user_garage_view&id=$entry[PostUser]">'$newyr $entry[make] $entry[model]</a></div>
</if>
<if condition="$vbulletin->options['postbittype'] == 2">
<div><img src="images/garage/car.png"><a href="garage.php?do=user_garage_view&id=$entry[PostUser]"> $post[username]'s Garage</a></div>
</if>
<if condition="$vbulletin->options['postbittype'] == 3">
<div><a href="garage_vehicle.php?do=view_vehicle&id=$entry[vehicle_id]">'$newyr $entry[make] $entry[model]</a></div>
</if>
<br />
The postbit type value is set from the ACP. Thanks for any insight into this!
if(THIS_SCRIPT == 'showpost' OR THIS_SCRIPT == 'showthread')
{
switch ($vbulletin->options['postbittype'])
{
case 1: $pbq = "ORDER BY `main_vehicle` DESC LIMIT 1"; break;
case 2: $pbq = "ORDER BY `main_vehicle` DESC LIMIT 1"; break;
case 3: $pbq = "ORDER BY `vehicle_id` DESC LIMIT 10"; break;
}
$sql = $this->registry->db->query("select *, " . TABLE_PREFIX . "garage_user_vehicle.user_id AS PostUser
from " . TABLE_PREFIX . "garage_user_vehicle
LEFT JOIN " .TABLE_PREFIX . "garage_makes
on (" .TABLE_PREFIX . "garage_user_vehicle.make_id=" .TABLE_PREFIX . "garage_makes.id)
LEFT JOIN " .TABLE_PREFIX . "garage_models
on (" .TABLE_PREFIX . "garage_user_vehicle.model_id=" .TABLE_PREFIX . "garage_models.id)
WHERE " . TABLE_PREFIX . "garage_user_vehicle.user_id='" . $post['userid'] ."' " . $pbq);
if($this->registry->db->num_rows($sql) > 0)
{
if($vbulletin->options['postbittype'] >= 3)
{
while ($entry = $this->registry->db->fetch_array($sql))
{
$newyr = substr($entry[made_year], -2);
eval('$template_hook[\'postbit_userinfo_right_after_posts\'] .= "' . fetch_template('postbit_garagelink') . '";');
}
} else {
$entry = $this->registry->db->fetch_array($sql);
$newyr = substr($entry[made_year], -2);
eval('$template_hook[\'postbit_userinfo_right_after_posts\'] .= "' . fetch_template('postbit_garagelink') . '";');
}
}
}
<if condition="$vbulletin->options['postbittype'] == 1">
<div><a href="garage.php?do=user_garage_view&id=$entry[PostUser]">'$newyr $entry[make] $entry[model]</a></div>
</if>
<if condition="$vbulletin->options['postbittype'] == 2">
<div><img src="images/garage/car.png"><a href="garage.php?do=user_garage_view&id=$entry[PostUser]"> $post[username]'s Garage</a></div>
</if>
<if condition="$vbulletin->options['postbittype'] == 3">
<div><a href="garage_vehicle.php?do=view_vehicle&id=$entry[vehicle_id]">'$newyr $entry[make] $entry[model]</a></div>
</if>
<br />
The postbit type value is set from the ACP. Thanks for any insight into this!