Skip Navigation

[Resolved] Creating a map showing the locations of users on the site

This thread is resolved. Here is a description of the problem and solution.

Problem: One of my map markers is placed out in the Pacific Ocean near Howland Island, but the address shows up in wp-admin in the correct location.

Solution: Remove any domain restrictions you may have in place on your Google Maps API key, then retest. You can replace the domain restrictions once all your map markers show up correctly.

Relevant Documentation: https://toolset.com/documentation/user-guides/display-on-google-maps/
https://toolset.com/documentation/user-guides/data-caching-for-google-maps-addresses/

This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by Alan Murray 7 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#556896
Screen Shot 2017-08-05 at 9.50.51 PM.png
Screen Shot 2017-08-05 at 9.51.27 PM.png

Toolset is a great set of plugins that has saved me countless hours as I've worked on our site, but I am having a problem tonight with using the Maps plugin with Views.

I have created custom user fields, one of which is an address. When I edit a user profile from the backend, I enter an address in the field and the map at the side places a marker at the location I've selected. The address is saved in the wpcf-home-town field in the wpcc-user-meta table, apparently as a string. I assumed that google then georeferences that string again each time it is needed.

I created a View for users (with any role) and placed a map outside the loop and the marker inside the loop using the wizard, and then, when that didn't work, I tried again using the Fields and Views buttons. The result was a map with no markers on it. I thought the problem might be with the looping somehow, so I simplified the problem and attempted to add a single marker to a map at the address of the logged in user. But, I could not even get that to work.

As you can see from the screenshot, the admin user on this site has an address in Las Vegas, which correctly shows up on the back end user edit form. The code used to create the map is shown below:

<p>[wpv-map-render map_id="map-test1"]<br />
[wpv-map-marker map_id="map-test1" marker_id="marker-1" marker_usermeta="wpcf-home-town" id="$current"][/wpv-map-marker]</p>
<p><button class="js-wpv-addon-maps-reload-map" data-map="map-test1">Reload Map</button></p>

As before, the map shows up and there is no marker on it. To check that the id was correctly being passed, I added a few lines as follows:

<p>[wpv-map-render map_id="map-test1"]<br />
[wpv-map-marker map_id="map-test1" marker_id="marker-1" marker_usermeta="wpcf-home-town" id="$current"][/wpv-map-marker]</p>
<p><button class="js-wpv-addon-maps-reload-map" data-map="map-test1">Reload Map</button><br />
My Address is: [types usermeta='home-town' user_is_author='true'][/types]</p>
<p>The Lat Long is: [types usermeta='home-town' format='FIELD_ADDRESS: FIELD_LATITUDE, FIELD_LONGITUDE' user_is_author='true'][/types]</p>

This is to show the address as text and then the lat/long for the address. As shown in the screen shot, the address is correctly printed below the map, but the latitude/longitude is not listed. Does this mean that google is not geolocating the address? Is that why the markers are not showing up?

Incidentally, I also include an address with a custom post type I have created and am able to create a map showing the location of that post on this same site, so I'm sure the google API is working correctly and I feel like I understand how to set up the map, but this has me stumped. What could I be doing wrong?

Any suggestions would be greatly appreciated.

Thanks.

#557021

Hi, please try these troubleshooting steps first:
- In the Google Maps API console, temporarily deactivate any domain restrictions you may have on your API key.
- Go to Toolset > Settings > Maps and click "Load stored data". Find the entry for Las Vegas, NV USA, delete it, then retest your map View. This should trigger a geocoding update, with the correct information.
- Open your browser's JavaScript console and look for any errors when the page loads.
- If the previous steps do not resolve the issue, continue.
- Disable all plugins except Toolset plugins and activate a default theme like Twenty Seventeen. Make sure you are using the latest versions of any Toolset plugins. If not, update, then retest. If the problem is resolved, reactivate your theme and other plugins one by one until the conflict is revealed.

Please let me know the results of these tests and we can go from there.

#557475

Thanks for your help.

I deactivated the domain restrictions and it started working. Thankfully, it seems to still be working even after I added the domain restrictions back in.