Created
May 24, 2024 13:19
-
-
Save matty0501/8f036840abc1495c6c41c936d062a59c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gravity Perks // Address Autocomplete // Update GravityView Geocoder with coordinates | |
* https://gravitywiz.com/documentation/gravity-forms-address-autocomplete/ | |
*/ | |
// Replace 123 with your form ID | |
add_action( 'gform_after_submission_123', function ( $entry, $form ){ | |
$address_field_id = 4; // Replace 4 with your address field ID | |
$lat_field_id = 6; // Replace 6 with your latitude field ID | |
$lon_field_id = 7; // Replace 7 with your latitude field ID | |
$entry_id = rgar( $entry, 'id' ); | |
$lat = rgar( $entry, $lat_field_id ); | |
$lon = rgar( $entry, $lon_field_id ); | |
gform_update_meta( $entry_id, 'gvmaps_lat_' . $address_field_id, $lat ); | |
gform_update_meta( $entry_id, 'gvmaps_long_' . $address_field_id, $lon ); | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment