Hi Waqar!
I want to know if it is possible to create a map with Toolset Maps to have a dynamic map of the location of our registered users
Hi,
Thank you for waiting and here are the steps to create a user view that shows each user's location on the map:
1. For this example, suppose that there are two single-line user fields for the city (user-city) and the country (user-country) and you'd like to show a list of all users with the "subscriber" role.
2. From WP Admin -> Toolset -> Views, please create a new view and set it to show the users with the subscriber role.
( screenshot: hidden link )
3. In the "Loop Editor" section, you'll include the shortcode for the map, map marker, and for any fields, that you'd like to show:
( screenshot: hidden link )
For example:
[wpv-layout-start]
[wpv-items-found]
[wpv-map-render map_id="map-1"][/wpv-map-render]
<!-- wpv-loop-start -->
<ol class="wpv-loop js-wpv-loop">
<wpv-loop>
<li>
Name: [wpv-user field="display_name"]<br>
City: [types usermeta="user-city"][/types]<br>
Country: [types usermeta="user-country"][/types]
[wpv-map-marker map_id='map-1' marker_id='marker-2' address='[types usermeta="user-city"][/types], [types usermeta="user-country"][/types]'][/wpv-map-marker]
<hr>
</li>
</wpv-loop>
</ol>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
Please note how I've used the values from the user's city and the country fields to pass on the "address" attribute value, in the "wpv-map-marker" shortcode:
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker
4. After that, you can insert this newly created view on your page, using the shortcode:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-view )
[wpv-view name="user-view"]
And this is how the view shows on the front-end:
Screenshot: hidden link
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar