Hi,
Thank you for contacting us and I'd be happy to assist.
If your goal is to set the current visitor's location as a default address in the Toolset Form's address type field, you can follow these steps:
1. In Toolset plugins, you can use the "wpv-geolocation" plugin to get the current visitor's location after his/her consent:
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-geolocation
You can wrap your form's shortcode within this shortcode, so that the form is only shown after the visitor has given the consent to use his/her location:
[wpv-geolocation]
[cred_form form="form-name"]
[/wpv-geolocation]
Note: You'll replace "form-name" with the actual name of your form.
2. Next, you'll need a custom shortcode, to extract the current visitor's location coordinates from the browser's cookies, (provided that the visitor has given the consent to use his/her location):
add_shortcode('get_current_user_location', 'get_current_user_location_func');
function get_current_user_location_func() {
$output = $_COOKIE['toolset_maps_location'];
return $output;
}
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.
3. The last step would be to use this shortcode [get_current_user_location] in the "Field default value" of the address type field in the form.
( example screenshot: hidden link )
As a result, when the form will load, the address field will automatically show the current visitor's location selected with the map marker on the map.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar