(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:
<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.
(This post was last modified: 09-01-2011 06:19 AM by RocketFoot.)
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:
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.