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?
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?
Sorry, it is an address field. The "rough location" part is an unnecessary detail, just think of it as location.
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/
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.
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.
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.
I typed the following shortcode, to make sure that the ID of the marker is unique. The shortcode will generate the post's 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/
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.
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.
My issue is resolved now. Thank you!