The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
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..
Code:
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') . '";');
}
}
}
Code:
<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 /> |
|
#2
|
|||
|
|||
|
Anyone have any ideas about this? Thanks.
|
|
#3
|
||||
|
||||
|
Did you look in your error_logs to see if there was a clue there about why it isn't working?
And I think you are supposed to use $vboptions[postbittype], not $vbulletin->options['postbittype'] in a template (it's fine as is in the plugin/php). |
|
#4
|
|||
|
|||
|
That was the problem. Thanks!! Wierd that it worked in everything pre-3.7.4 though...
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|