News:

Wondering if this will always be free?  See why free is better.

Main Menu

Google Member Map

Started by Spuds, December 12, 2007, 01:49:12 PM

Previous topic - Next topic

Juan Carlos

Above you can see that there are two hidden fields in the "forum profile" by the map, and below the scroll bar appears, but if you move it to the right everything is empty.

I hope I have explained because my English is very very bad.

Thank you
Juan Carlos

Redryder

#1001
OK

I see your problem, I also had this on my system. I think the table issue was messing up the code.

I have redone the code. It works on my system, see if it works on yours.


fix for 2.0 RC2 .....


I installed this in the  defult theme if you have another one this might not work.

The program went in fine for me except for the profile areas and the link on the member map to place your pin.

It should error out on install in the Profile Template file ( Profile.template.php) . This error is OK, just continue with install. If another file errors out then it probably is conflicting with another mod.

First please backup the files you are going to modify.

Then look for the Profile.template.php file in the defult theme directory.

To have the map show on the summery page.




Search For:


<dt>', $txt['location'], ':</dt>
    <dd>', $context['member']['location'], '</dd>';



Add after"


            if ($modSettings['googleMapsEnable'] && allowedTo('googleMap_view'))
{
  if (isset($context['member']['googleMap']['latitude']) && isset($context['member']['googleMap']['longitude']))
  {
   echo '

<dd>

   <script src="http://maps.google.com/maps?file=api&v=2&key=' . $modSettings['googleMapsKey'] . '" type="text/javascript"></script>
   <div id="map" style="width: 600px; 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'], '" />
   <script type="text/javascript">';
   // Evil hack on this!!!
   echo '
   //' . chr(60) . chr(33) . chr(91) . chr(67) . chr(68) . chr(65) . chr(84) . chr(65) . chr(91);
   echo '
   function LoadMap()
   {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(' . $context['member']['googleMap']['latitude'] . ',' . $context['member']['googleMap']['longitude'] . '), 13, '. $modSettings['googleMapsType'] . ');
    var point = new GLatLng(' . $context['member']['googleMap']['latitude'] . ',' . $context['member']['googleMap']['longitude'] . ');
    var marker = new GMarker(point);
    map.addOverlay(marker);
   }
   if (GBrowserIsCompatible()) {
    window.onload=LoadMap;
   }';
   // Let's make another evil hack!
   echo '
   //' . chr(93) . chr(93) . chr(62);
   echo '
     </script>
</dd>';
  }
}




Next you want to add this code so you can add/change your pin in the profile.

In the same file as above...

Search for:

(', $txt['total'], ': <span id="karmaTotal">', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</span>)
       </dd>';
}


Add after:




// Google Map Member Map
function template_profile_googlemap_modify()
{
global $txt, $modSettings, $context;
echo '
<dd><style type="text/css">
      @import url("http://www.google.com/uds/css/gsearch.css");
      @import url("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css");
     #map input, textarea {background-color: #ffffff;}
    </style>
         <script src="http://maps.google.com/maps?file=api&v=2&key=' . $modSettings['googleMapsKey'] . '" type="text/javascript"></script>
         <script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0" type="text/javascript"></script>
         <script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js" type="text/javascript"></script>
         <a name="googlemap"><div id="map" style="width: 600px; height: 350px; color: #000000;" align="center"></div></a>
         <div id="message" align="center">', $txt['googleMapPleaseClick'], '</div>
         <div id="disclaimer" align="center">', $txt['googleMapDisclaimer'], '</div>
         <input type="hidden" name="latitude" id="latitude" size="50" value="', $context['member']['googleMap']['latitude'], '" />
         <input type="hidden" name="longitude" id="longitude" size="50" value="', $context['member']['googleMap']['longitude'], '" />
         <script type="text/javascript">';
// Evil hack on this!!!
echo '
  //' . chr(60) . chr(33) . chr(91) . chr(67) . chr(68) . chr(65) . chr(84) . chr(65) . chr(91);
echo '
  function LoadMap()
  {
   var map = new GMap2(document.getElementById("map"));
   map.addControl(new GSmallMapControl());
   map.addControl(new GMapTypeControl());
   var options = {suppressInitialResultSelection : true, resultList : google.maps.LocalSearch.RESULT_LIST_SUPPRESS};
   map.addControl(new google.maps.LocalSearch(options), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));';

if (isset($context['member']['googleMap']['longitude']) && isset($context['member']['googleMap']['latitude']) && !empty($context['member']['googleMap']['longitude']) && !empty($context['member']['googleMap']['latitude']))
{
  echo '
   map.setCenter(new GLatLng(' . $context['member']['googleMap']['latitude'] . ',' . $context['member']['googleMap']['longitude'] . '), 13, ' . $modSettings['googleMapsType'] . ');
   var point = new GLatLng(' . $context['member']['googleMap']['latitude'] . ',' . $context['member']['googleMap']['longitude'] . ');
   var marker = new GMarker(point);
   map.addOverlay(marker);';
}
else
{
  echo '
   map.setCenter(new GLatLng(0,0), 1, G_NORMAL_MAP);';
}
echo '
   GEvent.addListener(map, "click", function(overlay, point) {
    if (overlay)
    {
     map.clearOverlays();
     document.getElementById("latitude").value = "";
     document.getElementById("longitude").value = "";
    }
    else if (point)
    {
     map.clearOverlays();
     map.addOverlay(new GMarker(point));
     map.panTo(point);
     document.getElementById("latitude").value = point.y;
     document.getElementById("longitude").value = point.x;
    }
   });
  }
  if (GBrowserIsCompatible()) {
   window.onload=LoadMap;
  }';
// Let's make another evil hack!
echo '
  //' . chr(93) . chr(93) . chr(62);
echo '
         </script>

</dd>';

}



I think that will be better with out the tables. I still don't quite get the new format but will learn over time. :)




Juan Carlos

It is now much better, almost perfect :) I am putting the new image.

Thank you very much for sharing.
Juan Carlos

Redryder

OK That is good!

I fixed the first part on the summery screen too.

Please replace the code I gave you before for it.

The one after


<dt>', $txt['location'], ':</dt>
    <dd>', $context['member']['location'], '</dd>';



It is in the corrected post above your last one.

It should work OK now. :)


Redryder

Quote from: Juan Carlos on November 17, 2009, 08:40:29 PM
It is now much better, almost perfect :)....

The only thing different from yours and mine is the scroll bar. Mine is not showing that. Please try clearing your cache on your browser to see if it goes away.

I do see it when I zoom in the page to 120% but on 100% I do not see it in my browser.

Juan Carlos

Well, all is ok I think, only the scroll bar remains. I already clean the cache, etc. but continues there, also appears in Explorer and Firefox but I do not believe that this is a big problem.

Thank you Redryder
Juan Carlos

Redryder

Is that IE8? Also firefox 3.0?

I tried IE8 and it was fine on my end no scrolls at any zoom.  :-\ I also use Seamonkey 2.0 and it works at 100%. It shows a scroll at 125% and above. But still works OK.

Any way at least it is functional for smf 2.0-RC2 now!  :)

Thanks for reporting on test this Juan Carlos


Juan Carlos

IE 8.0 and firefox 3.5.5.

As you say it is functional for smf 2.0-RC2. Great

Thanks again
Juan Carlos

peps1

#1008
Can someone help, I cant get this to work for toffee!

If i try and install though package manager i get the following errors

10.     Execute Modification     ./Sources/ModSettings.php             Test failed
11.    Execute Modification    ./Sources/Profile.php                            Test failed
12.    Execute Modification    ./Themes/default/index.template.php    Test failed

(have attached copies if that helps?)

And I have given the manual approach a go changing all the code as advised on my Forum version: SMF 1.1.10, but nothing....not even a Google Member Map tab in the Features and Options!?

Would really love to have this Mod in the forum, so if anyone can help it will be sincerely apprechiated!

Marcus Forsberg

Sorry for the lack of updates and support.
I'll look at RC2 support as soon as I can get around to.

Redryder

Quote from: Nas on November 18, 2009, 02:38:22 PM
Sorry for the lack of updates and support.
I'll look at RC2 support as soon as I can get around to.

It seems to work fine with the fix for 2.0 RC2 as posted. The changes just need to fixed in the install, then it would be good for 2.0 RC2.

It is a good mod I have used it for a number of years now. I used to know some of the cool hints and tips for it, but lost the website they were posted on.  I hope to rediscover them again!

Thanks again


SgtMic

Made the 2 manual edits described above and the mod works great so far.
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

peps1

#1012
Have installed the package with now errors showing up in packet manager BUT......
Why do I have
QuoteClick to place a point or click on your point to remove it.
Place your pin as close as you feel comfortable doing so.
twice?????



And non of my members pins are showing up on the map?  :'(

Redryder

Quote from: peps1 on November 22, 2009, 02:17:33 AM
Have installed the package with now errors showing up in packet manager BUT......
Why do I have
QuoteClick to place a point or click on your point to remove it.
Place your pin as close as you feel comfortable doing so.
twice?????



And non of my members pins are showing up on the map?  :'(

It looks like you have it installed twice. Did you try to install it a couple of times?

Some of the old code might not have been removed before. You will need to uninstall it and look for old code in the files using the package parser. Here is a link to one that may help you:

http://resourcez.biz/PackageParser/

But before you do that look if it shows like this in the default smf theme. If not then it is your theme template files, if so then look under the default themes template files.

It may take a little time to do this but it should fix the problem of two maps showing.

I think once you get the program removed and reinstalled right it should show the pins.



InsaneMustang

Can anyone confirm / deny that this will work in SMF 1.1.11

InsaneMustang

Tried and it got errors on the modsettings.php and the index.template.php

GunDude

Quote from: InsaneMustang on December 12, 2009, 09:50:10 PM
Tried and it got errors on the modsettings.php and the index.template.php

x2... hoping to move forward with an install but don't want to mess things up. Any help would be appreciated.


Redryder

Quote from: GunDude on December 14, 2009, 10:55:45 AM
Quote from: InsaneMustang on December 12, 2009, 09:50:10 PM
Tried and it got errors on the modsettings.php and the index.template.php

x2... hoping to move forward with an install but don't want to mess things up. Any help would be appreciated.


Quote from: InsaneMustang on December 12, 2009, 09:50:10 PM
Tried and it got errors on the modsettings.php and the index.template.php

What versions of smf are you using?

Mick.

Will this mod be update to RC2 sometime?

Marcus Forsberg

Yes, around new year it will. Probably between Christmas and New years eve.

Advertisement: