Google Member Map 2.6 SMF Mod Installation

I needed to move a Simple Machines Forum (SMF) forum from one domain name to another, which isn't difficult, but does require some configuration changes. I've moved a forum from one domain name to another before as described at Moving an SMF Forum From One Domain to Another. Since the forum was using version 2.0.8 of the Google Member Map mod, rather than the current version of the mod, the mod was using a Google Maps API key, which is not required for the current version of the mod, which is 2.6. After the move of the domain, anyone trying to access the Google Member Map feature would see the following error message:

This web site needs a different Google Maps API key. A new key can be generated at http://code.google.com/apis/maps/documentation/javascript/v2/introduction.html#Obtaining_Key.

I went to the Google Sign Up for the Google Maps API webpage, which I found the following:

Note: The Google Maps Javascript API Version 2 has been officially deprecated as of May 19, 2010. The v2 API will continue to work as per our deprecation policy, but we encourage you to migrate your code to version 3 of the Maps Javascript API.

I went to Google Maps JavaScript AVI v3 - Obtaining an API Key and followed the instructions there for obtaining a key for the new domain. I logged into a Gmail account and chose Create project. I clicked on the off button next to Google Maps API v3 and agreed to the Terms of Service to turn the service on. I didn't realize until after I installed the latest version of the Google Member Map mod, though, that the key isn't needed by the mod and there isn't even a way to specify the key.

After I got a new key, I tried installing the latest version of the SMF mod from Google Member Map, but saw installation errors for some files, so I uninstalled the prior version of Google Member Map that was on the system. That version was 2.0.8. I had to emulate version 2.0 of SMF instead of the 2.0.2 version that was installed for the forum to remove the prior version of Google Member Map. I also had to manually edit Themes/default/Profile.template.php and Themes/default/languages/Modifications.english.php to remove the prior version as mods installed after that version had changed the code in those files, so that the uninstall process didn't see the exact code it was expecting.

I had to manually edit Themes/default/Profile.template.php since the file had been modified by the installation of SMF Trader System, which inserted code between two lines that the installation process for Google Member Map was expecting to be together.

The installation process was looking for the follwing:

					<dd>', $context['member']['last_login'], '</dd>
				</dl>';

It would replace the code with the following:

				<dd>', $context['member']['last_login'], '</dd>';

	if (!empty($modSettings['googleMap_Enable']) && allowedTo('googleMap_view'))
	{
		if (!empty($context['member']['googleMap']['longitude']) && !empty($context['member']['googleMap']['latitude']))
		{
			echo '
	</dl>
<hr />
<br />
<dl>
	<dt><strong>' . $txt['googleMap_Where'] . ' ' . (preg_match('~\s(and|&|&)\s~i', $context['member']['name']) ? $txt['googleMap_Whereare'] : $txt['googleMap_Whereis']) . ' ' . $context['member']['name'] . ':</strong></dt>
	<dd>
		<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
		<div id="map_canvas" style="width: 100%; height: 350px; color: #000000;"></div>
		<input type="hidden" name="latitude" size="50" value="', $context['member']['googleMap']['latitude'], '" />
		<input type="hidden" name="longitude" size="50" value="', $context['member']['googleMap']['longitude'], '" />
		<input type="hidden" name="pindate" size="50" value="', $context['member']['googleMap']['pindate'], '" />
		<script type="text/javascript"><!-- // --><', '', '![CDATA[
			var latlng = new google.maps.LatLng(', $context['member']['googleMap']['latitude'], ', ', $context['member']['googleMap']['longitude'], ');
			var options = {
				zoom: 14,
				center: latlng,
				scrollwheel: false,
				mapTypeId: google.maps.MapTypeId.HYBRID,
				mapTypeControlOptions: {
					style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
				},
				zoomControl: true,
				zoomControlOptions: {
					style: google.maps.ZoomControlStyle.DEFAULT
				},
			};
			map = new google.maps.Map(document.getElementById("map_canvas"), options);
			var marker = new google.maps.Marker({
				position: latlng,
				map: map
			});
		// ]]', '', '></script>
	</dd>
</dl>';
		}
	}

I inserted the code starting with if (!empty($modSettings['googleMap_Enable']) && allowedTo('googleMap_view')) after the // END SMF Trader System in the Themes/default/Profile.template.php file after I proceeded with the installation process for Google Member Map despite the error.

You can access the settings for the Google Member Map mod by clicking on Admin, then Configuration, then Modification Settings , and then selecting Member Map. To enable the mod, check the box next to "The Google JavaScript Maps API V3 is a free service, available for any web site that is free to consumers. By enabling and using this SMF modification you are acknowledging and agreeing to the Google terms of use" then click on the Save button at the bottom of the page.

Though I had obtained a new key from Google, but there was no configuration setting for the Google Member Map mod that would allow me to specify the key, which isn't needed, but allows one to track the use of the feature.

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: Saturday July 7, 2012