MyBB Hacks

Full Version: User Map with XThreads?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9
(08-31-2011 09:43 AM)x-Treme Wrote: [ -> ]So we don't need an api key for this? Seems I can remember having to get one for the old plugin (but that was years ago).
Yes, we don't need an API Key for the newest version (Google Maps JavaScript API Version 3).

(08-31-2011 08:28 PM)RocketFoot Wrote: [ -> ]Would it be possible to link the member's username to the tooltip so when you run your mouse over a pin, it will show the member's username instead of thread title?
Edit the Display Format of the Geo Location custom thread field. Find:

Code:
title:"{$thread['subject']}"

Replace it with:

Code:
title:"{$thread['username']}"


(09-01-2011 12:37 AM)RocketFoot Wrote: [ -> ]Or, would it be possible to make the balloon pop open on mouse roll over?
We can assign a mouseover instead click for that (located in the Display Format of the Geo Location custom thread field).

Example:
Edit the Display Format of the Geo Location custom thread field. Find:

Code:
google.maps.event.addListener(marker{$thread['tid']}, 'click', function() {


Replace the click with mouseover.

Here is another example for the mouse event:
Display Format of the Geo Location custom thread field:

Code:
<if THIS_SCRIPT != 'forumdisplay.php' then>{VALUE}</if><setvar umap_title>$thread['uid'] ? '<div><strong><a href=\"'.get_profile_link($thread['uid']).'\">'.$thread['username'].'</a>, <a href=\"'.$threadurl.'\">'.$thread['subject'].'</a></strong></div><div class=\"smalltext\"><em>Pinned: '.$thread['threaddate'].', '.$thread['threadtime'].'</em></div>' : '<div><strong>'.htmlspecialchars_uni($mybb->user['username']).', '.htmlspecialchars_uni($mybb->input['subject']).'</strong></div><div class=\"smalltext\"><em>Pinned: '.my_date($mybb->settings['dateformat'], TIME_NOW).', '.my_date($mybb->settings['timeformat'], TIME_NOW).'</em></div>'</setvar><setvar map_msg>'<div><div class=\"float_left\" style=\"margin: 5px;\">'.$GLOBALS['threadfields']['umap_img']['value'].'</div>'.$tplvars['umap_title'].'<br />'.$GLOBALS['threadfields']['umap_desc'].'</div>'</setvar><setvar mymarker>$mybb->user['uid'] ? '<a href="'.$forumurl_q.'filterxt_uid='.intval($mybb->user['uid']).'">Where is my marker?</a>' : ''</setvar><if THIS_SCRIPT == 'forumdisplay.php' then>
var myLatlng{$thread['tid']} = new google.maps.LatLng{VALUE};
var marker{$thread['tid']} = new google.maps.Marker({
	position: myLatlng{$thread['tid']}, 
	map: map,
	title:"{$thread['subject']}"
});
var message{$thread['tid']} = "{$GLOBALS['tplvars']['map_msg']}";
var infowindow{$thread['tid']} = new google.maps.InfoWindow({
	content: message{$thread['tid']},
	size: new google.maps.Size(50,50)
});
google.maps.event.addListener(marker{$thread['tid']}, 'mouseover', function() {
	infowindow{$thread['tid']}.open(map,marker{$thread['tid']});
});
google.maps.event.addListener(marker{$thread['tid']}, 'mouseout', function() {
	infowindow{$thread['tid']}.close(map,marker{$thread['tid']});
});
google.maps.event.addListener(marker{$thread['tid']}, 'click', function() {
	window.location="{$threadurl}";
});
google.maps.event.addListener(marker{$thread['tid']}, 'rightclick', function() {
	map.setCenter(myLatlng{$thread['tid']});
	map.setZoom(9);
});</if>


Now, when a user mouseover a marker/pin, the balloon pop will be opened. The balloon pop will be closed when the marker/pin lose focus. Clicking a marker/pin will lead the user to the thread. Right clicking a marker/pin, will zoom in the map, and the map will be centered at the marker.
You can see it at the live demo:
http://xtest.byethost7.com/forumdisplay.php?fid=5
Try to mouseover, right click and click a marker (I've set the zoom level of the map in the showthread into a bigger value. It will make the thread author's location more "clearer").

I think I will update the example post using this method, because we still can use the thread for user discussions?

Works perfectly!  I went with the second option for balloon popups!

Thanks again!
One other problem...the tooltip on my classic postbit map is still showing subject instead of username even though I changed it as per above.  I don't need the popup balloon in the posbit but the username tooltip would be nice.
Edit your umap_showthread template. Find:

Code:
title:"{$thread['subject']}"

Replace it with:

Code:
title:"{$thread['username']}"


Additional setting you can play with is, the zoom level. If you want to change the zoom level in postbit/classic only, you can change the zoom value (at the same template) to get more details about the thread author's location:

Code:
zoom: 4,


For example, zoom: 15, will give this result:
http://xtest.byethost7.com/showthread.php?tid=20

Cool!  Good info...I will experiment!
I did have to bump my threads per page over ride up to 999 because some members were on page one and others on page 2.  How high can I actually set the over ride?
Realistically 1000 should probably be fine.
How high you can go depends on your server/setup of course.  Basically MyBB will load more into memory, meaning more memory consumption, more database transaction to load everything in etc.
It should only affect speed of that particular forum, correct?

I only have 800 members and a smaller fraction use the map so It should be ok.
Yes, only the forumdisplay page for that forum.
Uh oh...I have a problem!

My User Map went white screen just like the old version did!  What could be wrong?

http://www.7173mustangs.com/forum-member-map


It was working fine 15 minutes ago...no errors or anything??  Help!

ETA...I can still see the member's discussion threads:
http://www.7173mustangs.com/thread-terrell-texas

OK...never mind!  LOL...I figured out what was causing the blank screen:

imei Page Optimizer! (1.0.1)

For some reason it was killing the map!  I deactivated this plugin and the map came right back.
OK, now that my crisis has been adverted, I have a purely gingerbread request for this example!

Would it be possible to link the location in my member's post bit profile and regular profile page to the map in their discussion thread?  

I'm thinking it would be much like the bits used to link the vidoes and articles to the profile but I am unsure how to construct the bit!

Actually,for the member's profile page,it would be really cool to have a small map showing the member's pin!
Pages: 1 2 3 4 5 6 7 8 9
Reference URL's