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: #46
RE: User Map with XThreads?
Update: We will try to use Marker Clusterer Plus to cluster our marker.
  • Download markerclusterer_packed.js from here. Upload it to our /jscripts/ dir/folder.
  • Edit our umap_geol (Geo Location) custom thread fields:
    • Display Format:

      Code:
      <if THIS_SCRIPT != 'forumdisplay.php' then>{VALUE}</if><setvar umap_title>$thread['uid'] ? '<div class=\"gmap_if\"><strong><a href=\"'.get_profile_link($thread['uid']).'\">'.htmlspecialchars_uni($thread['username']).'</a>, <a href=\"'.$threadurl.'\">'.htmlspecialchars_uni($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>[{VALUE$1},"<func htmlspecialchars_uni>{$thread['username']}: {$thread['subject']}</func>","{$GLOBALS['tplvars']['map_msg']}","{$threadurl}"],</if>

    • Text Mask Filter:

      Code:
      ^\(((-?)([0-9]*)(?:\.(\d*)), (-?)([0-9]*)(?:\.(\d*)))\)$

  • Edit our umap_threadlist template:

    HTML 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
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    <html>
    <head>
    <title>{$mybb->settings['bbname']} - {$foruminfo['name']} </title>
    {$headerinclude}
    {$rssdiscovery}
    <script type="text/javascript">
    <!--
    	lang.no_new_posts = "{$lang->no_new_posts}";
    	lang.click_mark_read = "{$lang->click_mark_read}";
    // -->
    </script>
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/markerclusterer_packed.js"></script>
    <script type="text/javascript">
    var gmarkers = [];
    var map = null;
    var infowindow = new google.maps.InfoWindow();
    var myLatlng = new google.maps.LatLng(0,0);
    function createMarker(latlng,name,html,url) {
    	var contentString = html;
    	var marker = new google.maps.Marker({
    		position: latlng,
    		map: map,
    		title: name
    	});
    	marker.myname = name;
    	gmarkers.push(marker);
    	
    	google.maps.event.addListener(marker, "click", function() {
    		window.location = url;
    	});
    
    	google.maps.event.addListener(marker, "rightclick", function() {
    		infowindow.setContent(contentString); 
    		infowindow.open(map,marker);
    	});
    }
    
    function initialize() {
    	var myOptions = {
    		zoom: 2,
    		center: myLatlng,
    		mapTypeId: google.maps.MapTypeId.ROADMAP
    	}
    	map = new google.maps.Map(document.getElementById('map_threadlist'), myOptions);
    	google.maps.event.addListener(map, 'click', function() {
    		infowindow.close();
    	});
    	var markers = [{$threads}];
    	var mcOptions = {gridSize: 50, maxZoom: 15, title: 'Click to view all pins inside this cluster'};
    	for (i = 0; i < markers.length; i++) {
    		var point = new google.maps.LatLng(markers[i][0],markers[i][1]);
    		var name = markers[i][2];
    		var html = markers[i][3];
    		var url = markers[i][4];
    		var marker = createMarker(point,name,html,url);
    	}	
    	var mc = new MarkerClusterer(map, gmarkers, mcOptions);
    }
    </script>
    </head>
    <body onload="initialize()">
    {$header}
    {$moderatedby}
    {$usersbrowsing}
    {$rules}
    <br class="clear" />
    <div class="float_left">
    	{$multipage}
    </div>
    <div class="float_right">
    	{$newthread}
    </div>
    <br class="clear" />
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
    	<tr>
    		<td class="thead">
    			<div class="float_right"><strong>{$tplvars['mymarker']}</strong></div>
    			<strong>{$foruminfo['name']}</strong>
    		</td>
    	</tr>
    	<tr>
    		<td class="trow1">
    			<div id="map_threadlist" style="width:100%; height:500px"></div>
    		</td>
    	</tr>
    </table>
    <div class="float_left">
    	{$multipage}
    </div>
    <div class="float_right" style="margin-top: 4px;">
    	{$newthread}
    </div>
    <br style="clear: both;" />
    <br />
    
    <div class="float_right" style="text-align: right;">
    	{$inlinemod}
    	{$searchforum}
    	{$forumjump}
    </div>
    <br style="clear: both" />
    <div class="smalltext" style="text-align: center;">
    {$foruminfo['name']}<br />
    Powered By <a href="http://mybbhacks.zingaburga.com/showthread.php?tid=288">XThreads</a> &ndash; <a href="http://mybbhacks.zingaburga.com">MyBB Hacks</a>
    </div>
    {$inline_edit_js}
    {$footer}
    </body>
    </html>

   
http://xtest.byethost7.com/forumdisplay.php?fid=5
When we click the cluster (the blue circle), it will zoom and display all pins inside the cluster.

As an additional features (optional), I've updated the plugin in the example application posts (need to deactivate the previous version first before using the new version).
  • Find $umap_fid under umap_nt() function. Change the value to our XThreads Usermap forum id for limiting the num of pin for each user. By default, it is disabled.
  • Find $umap_fid under umap_run() function. Change the value to our XThreads Usermap forum id for displaying user's location on their profile page. By default, it is disabled.
   
http://xtest.byethost7.com/member.php?ac...http://xtest.byethost7.com/member.php?action=pro

I've updated the example application post, and add the additional screenshots.

Please tell me if there is something wrong with the code above Smile

12-27-2011 06:19 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
User Map with XThreads? - RocketFoot - 08-28-2011, 10:41 AM
RE: User Map with XThreads? - ZiNgA BuRgA - 08-28-2011, 11:11 AM
RE: User Map with XThreads? - RocketFoot - 08-29-2011, 10:27 AM
RE: User Map with XThreads? - ZiNgA BuRgA - 08-29-2011, 11:41 AM
RE: User Map with XThreads? - RocketFoot - 08-29-2011, 08:41 PM
RE: User Map with XThreads? - RateU - 08-30-2011, 07:39 AM
RE: User Map with XThreads? - Shemo - 08-30-2011, 03:26 PM
RE: User Map with XThreads? - RocketFoot - 08-31-2011, 03:43 AM
RE: User Map with XThreads? - ZiNgA BuRgA - 08-30-2011, 06:08 PM
RE: User Map with XThreads? - Shemo - 08-31-2011, 03:10 AM
RE: User Map with XThreads? - RateU - 08-31-2011, 08:16 AM
RE: User Map with XThreads? - ZiNgA BuRgA - 08-31-2011, 08:40 AM
RE: User Map with XThreads? - RocketFoot - 08-31-2011, 09:28 AM
RE: User Map with XThreads? - x-Treme - 08-31-2011, 09:43 AM
RE: User Map with XThreads? - RocketFoot - 08-31-2011, 10:05 AM
RE: User Map with XThreads? - x-Treme - 08-31-2011, 10:22 AM
RE: User Map with XThreads? - RocketFoot - 08-31-2011, 10:58 AM
RE: User Map with XThreads? - ZiNgA BuRgA - 08-31-2011, 12:20 PM
RE: User Map with XThreads? - RocketFoot - 08-31-2011, 08:28 PM
RE: User Map with XThreads? - RocketFoot - 09-01-2011, 12:37 AM
RE: User Map with XThreads? - RateU - 09-01-2011, 03:28 AM
RE: User Map with XThreads? - RocketFoot - 09-01-2011, 05:59 AM
RE: User Map with XThreads? - RateU - 09-01-2011, 06:35 AM
RE: User Map with XThreads? - RocketFoot - 09-01-2011, 06:44 AM
RE: User Map with XThreads? - RocketFoot - 09-01-2011, 08:14 PM
RE: User Map with XThreads? - ZiNgA BuRgA - 09-01-2011, 10:06 PM
RE: User Map with XThreads? - RocketFoot - 09-02-2011, 03:04 AM
RE: User Map with XThreads? - ZiNgA BuRgA - 09-02-2011, 07:29 AM
RE: User Map with XThreads? - RocketFoot - 09-03-2011, 01:16 AM
RE: User Map with XThreads? - RocketFoot - 09-03-2011, 03:11 AM
RE: User Map with XThreads? - RateU - 09-03-2011, 03:23 AM
RE: User Map with XThreads? - RocketFoot - 09-03-2011, 03:29 AM
RE: User Map with XThreads? - RateU - 09-03-2011, 04:24 AM
RE: User Map with XThreads? - RocketFoot - 09-03-2011, 04:57 AM
RE: User Map with XThreads? - RateU - 09-03-2011, 05:05 AM
RE: User Map with XThreads? - RocketFoot - 09-03-2011, 05:07 AM
RE: User Map with XThreads? - RateU - 09-03-2011, 05:16 AM
RE: User Map with XThreads? - RocketFoot - 09-03-2011, 05:19 AM
RE: User Map with XThreads? - RateU - 09-03-2011, 05:26 AM
RE: User Map with XThreads? - RocketFoot - 09-03-2011, 05:31 AM
RE: User Map with XThreads? - RateU - 09-03-2011, 05:42 AM
RE: User Map with XThreads? - RocketFoot - 09-03-2011, 05:49 AM
RE: User Map with XThreads? - RocketFoot - 10-21-2011, 05:34 AM
RE: User Map with XThreads? - RateU - 10-21-2011, 06:19 AM
RE: User Map with XThreads? - RocketFoot - 10-21-2011, 06:32 AM
RE: User Map with XThreads? - RateU - 12-27-2011 06:19 AM
RE: User Map with XThreads? - Lkwmonster - 06-06-2012, 05:05 AM
RE: User Map with XThreads? - RateU - 06-06-2012, 05:10 AM
RE: User Map with XThreads? - Lkwmonster - 06-06-2012, 05:21 AM
RE: User Map with XThreads? - RateU - 06-06-2012, 06:03 AM
RE: User Map with XThreads? - meister-igi - 09-26-2012, 09:30 AM
RE: User Map with XThreads? - MrBrechreiz - 10-28-2012, 10:11 AM
RE: User Map with XThreads? - meister-igi - 10-30-2012, 10:32 AM
RE: User Map with XThreads? - Scott - 10-26-2012, 12:35 PM
RE: User Map with XThreads? - ZiNgA BuRgA - 10-26-2012, 05:15 PM
RE: User Map with XThreads? - RateU - 10-27-2012, 01:10 AM
RE: User Map with XThreads? - Scott - 10-27-2012, 07:25 AM
RE: User Map with XThreads? - RateU - 10-28-2012, 01:06 AM
RE: User Map with XThreads? - Scott - 10-28-2012, 03:12 AM
RE: User Map with XThreads? - RateU - 10-29-2012, 01:59 AM
RE: User Map with XThreads? - MrBrechreiz - 10-30-2012, 04:53 PM
RE: User Map with XThreads? - meister-igi - 10-31-2012, 12:39 PM
RE: User Map with XThreads? - MrBrechreiz - 10-31-2012, 06:55 PM
RE: User Map with XThreads? - meister-igi - 11-01-2012, 08:45 AM
RE: User Map with XThreads? - RateU - 11-03-2012, 03:07 AM
RE: User Map with XThreads? - admin2u - 12-17-2012, 06:42 PM
RE: User Map with XThreads? - ZiNgA BuRgA - 12-18-2012, 09:12 AM
RE: User Map with XThreads? - admin2u - 12-22-2012, 06:57 AM
RE: User Map with XThreads? - admin2u - 12-22-2012, 07:27 AM
RE: User Map with XThreads? - Scott - 12-23-2012, 12:42 PM
RE: User Map with XThreads? - RateU - 12-24-2012, 05:57 AM
RE: User Map with XThreads? - Scott - 12-26-2012, 07:46 AM
RE: User Map with XThreads? - Scott - 12-28-2012, 09:04 AM
RE: User Map with XThreads? - Traax - 02-22-2013, 04:47 AM
RE: User Map with XThreads? - MrBrechreiz - 02-22-2013, 12:41 PM
RE: User Map with XThreads? - Traax - 02-23-2013, 03:08 AM
RE: User Map with XThreads? - bigvin - 01-31-2014, 11:26 PM
RE: User Map with XThreads? - bigvin - 02-02-2014, 11:43 PM
RE: User Map with XThreads? - bigvin - 04-14-2015, 11:34 PM
RE: User Map with XThreads? - RocketFoot - 02-17-2017, 03:07 AM
RE: User Map with XThreads? - RocketFoot - 12-02-2017, 08:41 PM
RE: User Map with XThreads? - ZiNgA BuRgA - 02-10-2018, 11:07 PM
RE: User Map with XThreads? - lenox - 04-30-2018, 05:29 AM
RE: User Map with XThreads? - RateU - 05-01-2018, 10:45 PM
RE: User Map with XThreads? - crow - 05-02-2018, 02:21 AM
RE: User Map with XThreads? - RateU - 05-04-2018, 10:15 PM

 Standard Tools
Forum Jump: