PDA

View Full Version : Show Thread Enhancements - Clickable user location using google maps


4x4 Mecca
04-19-2007, 10:00 PM
Introduction:
Have you ever wondered where Orange, CA (http://maps.google.com/maps?f=q&hl=en&q=Orange,%20Ca) was? Well now you can click on a users location and it'll bring it up in a new window via google maps.

Hack Requirements:
None

Original Version 1.0
Installation:
Find
<if condition="$post['field2']"><div>$vbphrase[location_perm]: $post[field2]</div></if>


Replace it with
<if condition="$post['field2']"><div>$vbphrase[location_perm]: <a href="http://maps.google.com/maps?f=q&hl=en&q=$post[field2]" title="Find $post[username] on Google Maps!" target="_blank">$post[field2]</a></div></if>


UPDATE:
I've changed it from the complete location being a link, to an image of a globe before their location. The globe is now the link, it's a much cleaner install

Upgrade instructions:
FIND in your postbit, or postbit_legacy
<if condition="$post['field2']"><div>$vbphrase[location_perm]: <a href="http://maps.google.com/maps?f=q&hl=en&q=$post[field2]" title="Find $post[username] on Google Maps!" target="_blank">$post[field2]</a></div></if>


REPLACE WITH

<if condition="$post['field2']">
<div>$vbphrase[location_perm]: <a href="http://maps.google.com/maps?f=q&hl=en&q=$post[field2]" title="Find $post[username] on Google Maps!" target="_blank"><img class="inlineimg" src="images/globe.gif" alt="Find $post[username] on Google Maps!" border="0" /></a> $post[field2]
</div></if>



Fresh install of new version
FIND in your postbit, or postbit_legacy
<if condition="$post['field2']"><div>$vbphrase[location_perm]: $post[field2]</div></if>


REPLACE WITH

<if condition="$post['field2']">
<div>$vbphrase[location_perm]: <a href="http://maps.google.com/maps?f=q&hl=en&q=$post[field2]" title="Find $post[username] on Google Maps!" target="_blank"><img class="inlineimg" src="images/globe.gif" alt="Find $post[username] on Google Maps!" border="0" /></a> $post[field2]
</div></if>



Demo:
4x4Mecca.com (http://www.4x4mecca.com/forum/showpost.php?p=12753&postcount=8)

4x4 Mecca
04-20-2007, 04:48 AM
I don't need to reserve this post :)

HMBeaty
04-20-2007, 04:58 AM
To work with MEMBERINFO, change
$post['field2']
To
$userinfo['field2']

4x4 Mecca
04-20-2007, 05:01 AM
Thanks! I'm new to this, should I update the mod with that option for users with an older version or something?

HMBeaty
04-20-2007, 05:03 AM
Thanks! I'm new to this, should I update the mod with that option for users with an older version or something?
MEMBERINFO should be in all in versions. Thats the template for the members profile page. The postbit and profile page just use 2 different variables

EDIT: However, you may want to rephrase your installation instructions and change "Find" to something like "In postbit/posbit_legacy find...."

PoetJA-1975
04-26-2007, 03:51 AM
Thanx for sharing this modification.
Question: What if someone has a "parody" as their location?
example = Location: Cyberspace, Tennessee

Jacquii.

4x4 Mecca
04-28-2007, 10:52 PM
Then google maps finds some silly results.... A member on my board has "So Cal (http://maps.google.com/maps?f=q&hl=en&q=So+Cal&sll=33.823013,-117.830148&sspn=0.008343,0.014462&layer=&ie=UTF8&z=12&ll=8.827403,48.833199&spn=0.158772,0.2314&om=1&iwloc=addr)"
Another has "At Home (http://maps.google.com/maps?f=q&hl=en&q=At+Home)"

PoetJA-1975
04-29-2007, 02:39 AM
LOL - OK - Thanx for the mod ;)

Jacquii.

Chicago_VLNU_4s
05-07-2007, 10:53 PM
seems decent but if people are spelling their city, not everyone will spell it right meaning no results. Like for example, Chicago. Some of us spell it "Chicago", "Chi-Town", "Chi Town", "Windy City", "The GO" ect.

l3it3r
05-08-2007, 10:20 AM
And you'll get interesting results in google.
I made a similar mod for phpBB3 nice work.

groovybaz
05-22-2007, 10:27 AM
Hi guys,

I noticed that this mod is not supported. It would be perfect for my forum.
Are there any problems that have occurred in installations at all? If anyone could give me a bit more info that would be great with regards to the safety of installing an unsupported mod as i am new to VBulletin.

Many thanks

PoetJA-1975
05-23-2007, 01:06 AM
Hi guys,

I noticed that this mod is not supported. It would be perfect for my forum.
Are there any problems that have occurred in installations at all? If anyone could give me a bit more info that would be great with regards to the safety of installing an unsupported mod as i am new to VBulletin.

Many thanks

There is basically no installation - it's a simple template modification
And it works fabulously - I like it very much ;)

Jacquii.

Pasqualis
05-23-2007, 07:08 AM
I just love this simple modification!! Thanks a lot 4x4 Mecca :D

I would also like to use this on my MEMBERINFO page, but this seems a little more complicated. Any adea how I could achieve that?

Oh, and one minor thing: better to use $vbphrase[location_perm]: in stead of Location: in your template mod. ;)

meissenation
05-23-2007, 05:52 PM
An issue I'm having is that it's not parsing the spaces as %20 so when it tries to link it links to:
http://maps.google.com/maps?f=q&hl=en&q=gun lake, MI
Instead of:
http://maps.google.com/maps?f=q&hl=en&q=gun%20lake,%20MI

4x4 Mecca
05-25-2007, 09:26 PM
I just love this simple modification!! Thanks a lot 4x4 Mecca :D

I would also like to use this on my MEMBERINFO page, but this seems a little more complicated. Any adea how I could achieve that?

Oh, and one minor thing: better to use $vbphrase[location_perm]: in stead of Location: in your template mod. ;)
Done, thanks!

4x4 Mecca
05-25-2007, 09:31 PM
An issue I'm having is that it's not parsing the spaces as %20 so when it tries to link it links to:
http://maps.google.com/maps?f=q&hl=en&q=gun lake, MI
Instead of:
http://maps.google.com/maps?f=q&hl=en&q=gun%20lake,%20MI

I'm not sure why, if you and make an admin account, I'll check it out.

venomx
05-31-2007, 11:57 PM
I tried this on my new forum I am making... I live in Washington, PA but the google map shows up wrong..

It gives this URL: http://maps.google.com/maps?f=q&hl=en&q=Washington, PA
When I am over here: http://maps.google.com/maps?f=q&hl=en&q=Washington,+PA+15301

4x4 Mecca
06-01-2007, 07:46 PM
If anyone is having trouble, and wants me to help, I would need admin access to test edit the template. PM me if you have created an account and I'll see if I can fix it.

venomx
06-02-2007, 12:34 AM
Its not a bug in your script, its because in Pennsylvania theres a few dozen "Washington's" it just picks the wrong one unless I include the zip code....

4x4 Mecca
06-02-2007, 01:37 AM
I thought it had to do with the field2 being in quotes, not apostrophe's, like this
OLD CODE
<if condition="$post['field2']">
<div>$vbphrase[location_perm]: <a href="http://maps.google.com/maps?f=q&hl=en&q=$post[field2]" title="Find $post[username] on Google Maps!" target="_blank"><img class="inlineimg" src="images/globe.gif" alt="Find $post[username] on Google Maps!" border="0" /></a> $post[field2]
</div></if>

New Code
<if condition='$post['field2']'>
<div>$vbphrase[location_perm]: <a href='http://maps.google.com/maps?f=q&hl=en&q=$post[field2]' title='Find $post[username] on Google Maps!' target='_blank'><img class='inlineimg' src='images/globe.gif' alt='Find $post[username] on Google Maps!' border='0' /></a> $post[field2]
</div></if>

I just replaced all the " with '

I searched google maps for http://maps.google.com/maps?f=q&hl=en&q=Washington+pa and it shows up

venomx
06-02-2007, 02:51 AM
That link takes me to a Washington 138 miles away from me. :(

4x4 Mecca
06-02-2007, 04:00 AM
Maybe if you wanted to add an extra option field that is required for user zip codes, you could use that one.