Skip Navigation

[Resolved] Map of user locations

This support ticket is created 3 years, 9 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.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 10 replies, has 2 voices.

Last updated by MikeS1622 3 years, 9 months ago.

Assisted by: Jamal.

Author
Posts
#1993861

I want to have a map displaying the "location" of my registered users so that potential users can see the value of joining the network. I created a custom user form field called "location" which asks the user for a rough location (i.e. city/state/country), but I can't see a way of getting the map or a view block to show user form data (aside from current user location).

Is there a way of doing this?

#1994209

Hello and thank you for contacting the Toolset support.

I am not sure to understand what did you mean by which asks the user for a rough location (i.e. city/state/country)
Are you using an Address field or single-line fields?

Note that a map can display markers, either from an Address field or using coordinates{latitude, longitude}. Can you take a screenshot of the field in Toolset->Custom Fields so I can know what type of fields are you using?

#1994667

Sorry, it is an address field. The "rough location" part is an unnecessary detail, just think of it as location.

#1995099

Awesome. In this case, you only need a user view and a map. Unfortunately, user views are not yet supported in the block editor. You will need to activate the legacy editor and create the view in it using shortcodes. Let me know if you need help or guidance with that!

First, activate the legacy editor in Toolset->Settings->General(tab)->Editing Experience.
Then, refresh the page to make the "Toolset->Views" menu item appear.
Go to Toolset->Views, and click on "Add New". Choose to create a user view.
Inside the legacy editor, add a map shortcode in one of the editor's sections. And inside the loop editor section, use the views button to add a marker shortcode into the view.

Read more about the available Toolset shortcodes below:
- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/
- https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/

#1997599

Thanks Jamal, looks like this is possible then! I'm having a little trouble getting to work though so some extra help would be much appreciated.

I've activated the legacy editor (I think... I selected the "Show both the legacy and Blocks interface and let me choose which to use for each item I build" option) and refreshed to find "Views", then clicked "Add New", but then I got a bit lost.

#1997685

I am sure you missed choosing users in the content selection section. Check this screenshot hidden link
Then, add a map shortcode, and a marker shortcode inside the view's loop. I recorded a screencast of the whole process hidden link

I hope this helps. Let me know if you have any questions.

#1997745

This is excellent, thanks so much. I'm just trying it now. What do you type into the marker id? It looks like shortcode style text but the qualiyy isn't high enough for me to make it out.

#1997805

I typed the following shortcode, to make sure that the ID of the marker is unique. The shortcode will generate the post's ID:

[wpv-post-id]

Read more about Toolset shortcodes for views and maps here:
- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/
- https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/

#1997829

Awesome. This great. I think I've got it working. Only one more thing for now: Is there a way of putting dynamic content in the marker title, it defaults to the username, I can change it to static text with the marker_title='' attribute. Also how could I disable the hover altogether? I'm not 100% sure what my client would prefer yet.

#1997847

The marker_title attribute is what populates the on-hover popup. If nothing is used inside of it, it will fall back to the user's nicename. You can use the Toolset shortcodes inside of it. I am not sure it is possible to deactivate the on-hover effect. Let me know if you need to, and I'll check with our 2nd Tier.
Read more about the shortcode here https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker

When a marker is clicked, it opens a popup, the content of the popup can be customized inside of the marker content. For example:

[wpv-map-marker map_id='map-all-users' marker_id='marker-[wpv-post-id]' marker_usermeta='wpcf-user-location']
Name: [wpv-user field="user_firstname"] [wpv-user field="user_lasttname"] 

Address: [types usermeta='user-location'][/types]
[/wpv-map-marker]

Check the result hidden link

However, for support rules, we are able to handle only one issue at a time. This helps us to bring you a better service and also helps other users to find all the information here exposed. For that reason I have to kindly ask you to open a new thread if you need further assistance, you can assign it directly to me. In that way, you don't have to wait and we can continue working on it.

#1997849

My issue is resolved now. Thank you!