Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 User Map with XThreads?
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #21
RE: User Map with XThreads?
(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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<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?


09-01-2011 03:28 AM
Find all posts by this user Quote this message in a reply
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #22
RE: User Map with XThreads?
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.

[Image: gallery_2_628_39582.jpg]
(This post was last modified: 09-01-2011 06:19 AM by RocketFoot.)
09-01-2011 05:59 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #23
RE: User Map with XThreads?
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


09-01-2011 06:35 AM
Find all posts by this user Quote this message in a reply
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #24
RE: User Map with XThreads?
Cool!  Good info...I will experiment!

[Image: gallery_2_628_39582.jpg]
09-01-2011 06:44 AM
Find all posts by this user Quote this message in a reply
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #25
RE: User Map with XThreads?
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?

[Image: gallery_2_628_39582.jpg]
09-01-2011 08:14 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #26
RE: User Map with XThreads?
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.

My Blog
09-01-2011 10:06 PM
Find all posts by this user Quote this message in a reply
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #27
RE: User Map with XThreads?
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.

[Image: gallery_2_628_39582.jpg]
09-02-2011 03:04 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #28
RE: User Map with XThreads?
Yes, only the forumdisplay page for that forum.

My Blog
09-02-2011 07:29 AM
Find all posts by this user Quote this message in a reply
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #29
RE: User Map with XThreads?
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.

[Image: gallery_2_628_39582.jpg]
(This post was last modified: 09-03-2011 02:36 AM by RocketFoot.)
09-03-2011 01:16 AM
Find all posts by this user Quote this message in a reply
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #30
RE: User Map with XThreads?
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!

[Image: gallery_2_628_39582.jpg]
(This post was last modified: 09-03-2011 03:17 AM by RocketFoot.)
09-03-2011 03:11 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: