We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21671
    • 244 Posts
    Hey All,

    I have a client who wants to create a site with approximately 5oo web users. Each user should be able to edit their profile. Each user would have an image, hometown, marrital status, industry, company they work for that they can set themselves. They can search for each other based on their profile fields mentioned above. The client wants the webusers to be able to message each other as well.

    And to top it off, they want a google map to show pins for where all the users live.

    What is the best way to accomplish this? Is it a webloginPe and SMF solution? any recommendations for techniques or strategies would be super appreciated.

    -Noah
      • 3749
      • 24,544 Posts
      WebLogin would be a good start. You may not need SMF unless you require threaded discussions. If you just need the ability to PM another user, eForm would probably be the way to go.

      This might help on the mapping: http://modxcms.com/forums/index.php/topic,8043.0.html
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 29774
        • 386 Posts
        Actually the Googlemap snippet won’t do what you want, and neither will the variant linked to above since it only supports one point per map. However check out the Google Maps API, it is actually quite easy to create a custom snippet to pass multiple lat/long points and output corresponding markers on a Google map. The hard bit is actually how you geocode the points for each user when their account is created. Essentially you would need to create text entry fields for the user’s address and a geocode button to position a marker on a Google map; the marker should be draggable so the user can reposition dynamically. The marker position would update lat and long fields with it’s position, and then these values would be stored in the webloginpe extended atrributes table when the user registers or updates their profile. Lucky for you I’ve already done something like this smiley

        In the <head>:

        	<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQ..."></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
        <script language="JavaScript" type="text/javascript">
        
        function showAddress(address, fallback) {
        		       	if (geocoder) {
        		        	geocoder.getLatLng(
        		          		address,
        		          		function(point) {
        		            		if (!point) {
        								if (fallback !=='') {
        									showAddress(fallback);
        								} else {
        		              				alert(address + ' not found.');
        								}
        		            		} else {
        				  			$('input[name=lat]').attr('value',point.lat().toFixed(5));
        		     					$('input[name=long]').attr('value',point.lng().toFixed(5));
        							renderPosition(point);
        
        		            		}
        		          		}
        		        	);
        		      	}
        		    }
        		
        			function renderPosition(point) {
        				map.clearOverlays();
        				map.setCenter(point, 14);
        				var marker = new GMarker(point, {draggable: true});  
         				map.addOverlay(marker);
        
        				GEvent.addListener(marker, 'dragend', function() {
        					var pt = marker.getPoint();
        					map.panTo(pt);
        					$('input[name=lat]').attr('value',pt.lat().toFixed(5));
         					$('input[name=long]').attr('value',pt.lng().toFixed(5));
        
        					GEvent.addListener(marker, 'dragend', function() {
          						var pt = marker.getPoint();
        						map.panTo(pt);
          						$('input[name=lat]').attr('value',pt.lat().toFixed(5));
             					$('input[name=long]').attr('value',pt.lng().toFixed(5));
            				});
        				});
        				
        				GEvent.addListener(map, 'moveend', function() {
          					map.clearOverlays();
        					var center = map.getCenter();
          					var marker = new GMarker(center, {draggable: true});
          					map.addOverlay(marker);
          					$('input[name=lat]').attr('value',center.lat().toFixed(5));
         					$('input[name=long]').attr('value',center.lng().toFixed(5));
        
        					GEvent.addListener(marker, 'dragend', function() {
          						var pt = marker.getPoint();
        						map.panTo(pt);
          						$('input[name=lat]').attr('value',pt.lat().toFixed(5));
             					$('input[name=long]').attr('value',pt.lng().toFixed(5));
            				});
        
        				});
        			}
        		
        			$("input[name=lat]").after(' <input type="button" id="geocode" value ="Geocode" /><br /><br /><div id="map" style="width: 400px; height: 300px"></div>');
        			
        			$("input[name=long]").parent().parent().next().remove();
        			
        			$('#geocode').click(function() {
        				var address 	= $('input[name=address1]').attr('value');
        				var city 		= $('input[name=city]').attr('value');
        				var zip			= $('input[name=zip]').attr('value');
        				var country		= $('select[name=country]').attr('value');
        				
        				if (address !== '' && city !== '' && country) {
        					if (zip !== '') {
        						// use zip if it's set
        						showAddress(address+', '+city+', '+zip+', '+country, city+', '+country);
        					} else {
        						showAddress(address+', '+city+', '+country, city+', '+country);
        					}	
        				} else {
        					alert('You need to fill in at least Address 1, Town/City, and Country to use Geocoding');
        				}
        				return false;
        			});
        			
        			// init
        			var geocoder = new GClientGeocoder();
        			var map = new GMap2(document.getElementById("map"));
        			map.addControl(new GSmallMapControl());
        	       	map.addControl(new GMapTypeControl());
        			var lat =  $('input[name=lat]').attr('value');
        			var long = $('input[name=long]').attr('value');
        			
        			if (lat == '' && long =='') {
        				// default
        				showAddress('31 Finsbury Circus, London, EC2M 5SQ, UK');
        			} else {
        				point = new GLatLng(lat, long);
        				renderPosition(point);
        			}
        	
        </script>
        
        



        For this to work you need your form to include the following input fields with name and id values: lat, long, address1, city, country, zip
          Snippets: GoogleMap | FileDetails | Related Plugin: SSL