PDA

View Full Version : Add-On Releases - CND Garage add-on: Show cars in postbit


flup
01-20-2009, 10:00 PM
This plugin is made for the CND Garage system (click (http://www.cnd-systems.com/support/forums/forumdisplay.php?f=30)) and will display the cars a user has in his garage. If there are no cars in the users garage, there wont be displayed anything :)

EDITS / UPLOADS / IMPORTS
- 1 plugin import
- 1/2 template edits

INSTALLATION GUIDE
First of all, import the plugin using: admincp -> Plugins & Products -> Download / Upload Plugins, the import form is on the bottom of the page.

After that, edit your postbit and/or postbit_legacy templates and find:
<div>
$vbphrase[posts]: $post[posts]
</div>

Below it add:
<if condition="$show[garage_cars]"><div><small><b><a href="garage.php?do=user_garage_view&id=$post[userid]">$post[musername]'s Garage</a></b>:<br />$post[garage_cars]</small></div></if>

RESULT
See the attached screenshot for the result, of course this one is customized to fit my forum style :)

VERSIONS

1.00 - Vehicles order by date of adding to the CND Garage
1.01 - Order of the vehicle list by putting the main vehicle on top followed by the other/previous vehicles


CUSTOM TEMPLATE EDIT GUIDE
If you have a custom style, you can use these codes in your postbit templates:

To display the link to a users garage:
<a href="garage.php?do=user_garage_view&id=$post[userid]">$post[musername]'s Garage</a>

To display the users cars (+ links to the cnd garage car page):
$post[garage_cars]

Both can be placed between the following tags, these check if there are any cars found for the users:
<if condition="$show[garage_cars]">
and
</if>

recklessop
01-23-2009, 12:45 AM
This looks like EXACTLY what we have been waiting for

flup
01-23-2009, 06:39 AM
Seems that it was already released under cnd itself (at their forums), however it looks a bit different as mine checks wether you actually have cars in your garage, if not - it won't display anything.

I'm not sure how their plugin works, but at least this was a good test for me to start getting used to the plugin system of vB :P

Haltech
01-23-2009, 08:43 AM
I own the CND Garage but since half of my users are IE7 guys, they cant even use the garage, which is a shame. i added your plugin for the post bit anyhow, no issues. Thanks.

flup
01-23-2009, 09:31 AM
How come? I haven't had any messages from users that it wouldn't work in IE7 .. http://www.clubpunto.nl/garage.php is the link to my garage.. guess I'm gonna check this out for myself anyhow, perhaps I can find a fix :)

I disabled a lot of features for now, but the things I can find in the first couple of pages is only a template error.
While viewing my own vehicle, it showed the 'Add as primary' button next to a photo instead of above, which kinda stretched my website to wide. Other than that, everything seems to go find (submit forms, image uploads, viewing vehicles/modifications).

Blackheart_72
02-26-2009, 06:37 AM
Fantastic mod fella, works just as i want it to. :)

River_rush
03-14-2009, 12:24 PM
Missing the table prefix from the xml code, it works if you edit the line after // Get Cars from database to read


$cars = $this->registry->db->query("SELECT uv.vehicle_id, model.model, make.make FROM " . TABLE_PREFIX . "garage_user_vehicle uv, " . TABLE_PREFIX . "garage_makes make, " . TABLE_PREFIX . "garage_models model WHERE uv.make_id = make.id AND uv.model_id = model.id AND uv.user_id = '".$post[userid]."' ORDER BY uv.main_vehicle DESC");
if($this->registry->db->num_rows($cars) > 0) {

Redzzand
03-16-2009, 02:09 AM
Missing the table prefix from the xml code, it works if you edit the line after // Get Cars from database to read


$cars = $this->registry->db->query("SELECT uv.vehicle_id, model.model, make.make FROM " . TABLE_PREFIX . "garage_user_vehicle uv, " . TABLE_PREFIX . "garage_makes make, " . TABLE_PREFIX . "garage_models model WHERE uv.make_id = make.id AND uv.model_id = model.id AND uv.user_id = '".$post[userid]."' ORDER BY uv.main_vehicle DESC");
if($this->registry->db->num_rows($cars) > 0) {

where can this be found? what file?

Edit: Found it under Plugins & Products >> Plugin Manager >> Edit "Show CND Cars in Postbit" >> Plugin PHP Code

Edit 2: Thanks a million for this code! With this code, it works on 3.8.1 PL1!!!

ArchangelX
03-18-2009, 04:08 AM
Thanks a bunch! Works even on 3.5!

externalaw.com
03-21-2009, 01:59 AM
we found an IE fix, this product is not working if you use Cyb New Posts hack

Jamey
04-22-2009, 03:31 PM
I had to make a couple adjustments...installed! Thanks.

corsacrazy
08-21-2009, 02:53 PM
Missing the table prefix from the xml code, it works if you edit the line after // Get Cars from database to read


$cars = $this->registry->db->query("SELECT uv.vehicle_id, model.model, make.make FROM " . TABLE_PREFIX . "garage_user_vehicle uv, " . TABLE_PREFIX . "garage_makes make, " . TABLE_PREFIX . "garage_models model WHERE uv.make_id = make.id AND uv.model_id = model.id AND uv.user_id = '".$post[userid]."' ORDER BY uv.main_vehicle DESC");
if($this->registry->db->num_rows($cars) > 0) {


hmm even with this mod i still get an error :( using latest vb 3.8

NTMID8
09-14-2009, 05:20 PM
Had this working great but it stopped working with one of the latest revisions of CND. I'm on CND 2.0.5 now and no longer showing in postbit, so something has changed with the conditional maybe?