Skip Navigation

[Resolved] Distance Search /Use My Location

This support ticket is created 5 years, 2 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by julieP 5 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1329117

I've implemented a means of only loading maps if users give consent (following 'Approach 2' provided here https://toolset.com/forums/topic/toolset-maps-and-gdpr-cookie-consent-plugin-seems-to-conflict/#post-1326825).

I'm now looking to implement the method for the 'Use My Location' button in distance searches but the View doesn't show any code I can wrap inside the wpv-conditional shortcode. How do I achieve this please?

#1329175

Hello,

The "Use my location" button is outputted from shortcode [wpv-control-distance], so you just need to use that shortcode [wpv-conditional] to wrap the shortcode [wpv-control-distance], for example:

[wpv-conditional if="( '[ts-generic-get-cookie-value]' eq 'yes' )"]
    [wpv-control-distance compare_field="test-addr" distance_center_url_param="toolset_maps_distance_center" distance_radius_url_param="toolset_maps_distance_radius" distance_unit_url_param="toolset_maps_distance_unit"]
[/wpv-conditional]
#1329189

Hi Luo

If I do that, it takes out the 'compare_field' too rendering it impossible to search by distance altogether. I just want to remove the use My Location button but still allow Users to search with X miles of a town that they enter.

#1329197

There isn't such kind of built-in feature within Toolset plugins, since the "Use my location" button is integrated into shortcode [wpv-control-distance], there isn't such a independent shortcode for "Use my location" button, so you will need to use [wpv-conditional] shortcode to wrap the entire [wpv-control-distance] shortcode.

Even if you use CSS codes to hide the "Use my location" button, it will load Google JS file in client browser too, it will break GDPR policy too.

#1329255

If I wrap the entire View in the [wpv-conditional] shortcode, will that stop Google's JS file from loading in the user's browser?

#1329257

It should be able to prevent Google's JS file from loading, this is Beda's custom codes solution:
https://toolset.com/forums/topic/toolset-maps-and-gdpr-cookie-consent-plugin-seems-to-conflict/#post-1326825

If it still can not prevent Google's JS file from loading, then that still violate GDPR policy.

You can test it, check if it works.

#1329269

My issue is resolved now. Thank you!