GEO my WP
BuddyForms does not support the Geo my WP plugin out of the box. You need to do some coding to make them work together. We will guide you through the complete process in this Documentation.
If you want to update the GEO my WP location of a post after form submission you need to copy the below function into your functions.php and change the SLUG to the form element slug.
You can find the form element slug in the Form Builder in the form element advanced tab. See this animated gif highlighting the form element creating process and the slug under the advanced tab
Step by Step
- Copy the function into your function.php and change the function prefix my_ to something else.
- Make sure you change the SLUG "$address = get_post_meta( $post_id, 'SLUG', true );" to the form element slug you use to collect the address.
Tip: You can also combine different post meta if you have multiple form elements for the address in your form.
$street = get_post_meta( $post_id, 'Street-SLUG', true );
$number = get_post_meta( $post_id, 'Number-SLUG', true );
Combine to: $address = $street . ' ' . $number;
What the script does:
When creating new posts or updating existing posts using BuddyForms the address field in the form will be geocoded and saved into GEO my WP custom table in the database which will make the post searchable using GEO my WP search forms.
To read more about the gmw_pt_update_location() function please see the GEO my WO Documentation.
Thats it! Test your integration.