Support Forum
Support › MB User Profile › Google Map Field attached to User Profile not updatingResolved
Hi! I have a Google Map field attached to user profile where users update their profile info through a WS Form submission. The Google Map address field is mapped to custom text fields -> city, state, country and those fields are being properly updated however the Google Map field is not updating to reflect the new values. How can I fix this? Thanks!
Hello Suzanne,
The Google map field saves the location in the following format latitude,longitude,zoom
(you can also check it in the database). You can contact WS Form to ask them which data format is processed after submitting the form. Then you can use the function rwmb_set_meta() or update_user_meta() to set/update the field value with the correct format.
Please read more on the documentation
https://docs.metabox.io/fields/map/#data
https://docs.metabox.io/functions/rwmb-set-meta/
https://developer.wordpress.org/reference/functions/update_user_meta/
Thank you Peter. Could you please elaborate on this? I am confused. When I update the fields in the back end manually, the Google Map field works flawlessly; however, when I update the fields using a form submission, the map data isn't refreshed.
Looking at your Google Map documentation, I believe that the function rwmb_the_value( 'my_field_id', $args ); pulls in the lat, long and zoom of my_field_id which is the address field that we map it to in my case city, state, country. As I said if I update the fields in the backend, it works flawlessly. The problem is that the map field doesn't get updated when values are received from WS Form. How is the map search triggered? Does this function run again after the data is sent to the Google Map address field(s) or does it need to be re-run to refresh the map?
Hello,
What I means is when using the WS Form, the Map field value is not saved with the correct format latitude,longitude,zoom
as written down in the documentation. That's why it does not work.
Also, the WS Form team maintains compatibility with Meta Box so I recommend contacting them to ask for help with this issue. You can send the link to this topic to them when submitting a question.
Please read more here https://docs.metabox.io/compatibility/
Thank you for your response. I'm sorry, I think I'm not explaining myself correctly, or I'm really confused. When using Metabox's Google Map field, I use the address field that is provided to map to text fields - city, state and country. These text fields (which I don't believe would have lat, lon and zoom?) are updated using WS Form. I am not using WS Form's map field. If I use their map field and map it to Metabox's map field, the map updates; however, I am no longer able to search based on city, state or country. This is why I want to be able to use the address field provided in the Metabox Google Map field to update the map. Maybe I'm taking the wrong approach? I hope this makes sense, thank you!
To clarify, we are populating the city, state and country fields with a text value, the same as when we write it directly in the back end and it works when we write it directly in the back end. Thank you again for your help!
Hello,
Thanks for your additional information.
I understand the issue. If you use the Meta Box Google map field (and address field maybe), you are using the extension MB Geolocation also to populate the info (city, country ...) to the address fields. Please read more here https://docs.metabox.io/extensions/meta-box-geolocation/
And it is possible that the extension MB Geolocation is not integrated with WS Form on their end (the team creates the integration).
I hope that makes sense.
Thank you for this documentation. Between the documentation, WS Form's Google Address and Google Map, the map and search are both working perfectly. Thank you!
Hey Suzanne! I'm having a similar issue getting Google Maps fields to update properly when given certain information. Would I be able to pester you for information on how you got things working on your end? I know it's over a year later but I'm in a bind. Happy to pay for your time.
Hi there! Happy to help if I can, how do I contact you?
Oh, you're awesome alex _at_ digisavvy.com - I'm pretty much doing this exact thing and just need some clarification. I'm going to tinker but if I can bounce questions off of you about your setup that would be super helpful.