the problem with geolocation is that it is not systematically enabled on all browsers. You have check with your own javascript code to test if your visitor’s browser has it.
If you do get a location coord to initialise the map, then you would need to setup a new marker and a new centre.
Currenlty there ins’t an easy way to achieve this, I can add this in a future release.
If you have some javascript skills, you can interact with your map once it is initialised. The plugin uses the Gmap3 js plugin, which has a method to retrieve the google map object,
$('#cf7-googlemap-<field-name>').gmap3().get(0)
where <field-name>
is the name of the field containing the map in your form.
Thread Starter
ten_nom
(@virtualnomad)
Thank you for your response.
My idea is: A button or icon “find my location”, right next to the address search text box.
If the user clicks the button, the browser will ask him to allow access to his location (default way).
Once access is granted, the user’s coordinates are marked with a marker on the map and the coordinates are also passed to the hidden field of the contact form. (as it is now with manual search.)
I think my knowledge of JS is not enough for this and the modification would take me too much time.
After a little research, I think a lot of users would appreciate this functionality. It would be great if you added it to the next update.
There is the same functionality in this plug-in, but it looks like dev is no longer working on it and its other features are not optimised. https://wordpress.org/plugins/location-module-for-contact-form-7/
-
This reply was modified 5 years, 1 month ago by ten_nom.
Assuming a visitor would grant access to their location, this would only work on a mobile phone/GPS enabled device. Anyone visiting your site from a computer would have the location of your ISP show up (several km away in most cases).
You can see this from this site.
After a little research, I think a lot of users would appreciate this functionality. It would be great if you added it to the next update.
well so far you’re the first. So unless there is a lot of requests and/or I need this in one of my own projects then it won’t be very high on my list of TODOs. Sorry. You could hire me to implement it if its something that’s urgent.
There is the same functionality in this plug-in,
Doesn’t look like it from this support thread.