I am trying to: pass custom fields populated by the user in a CRED form (address-1, address-3, county, postcode) to the 'Geo My WordPress' plugin in order to geocode the lat/long coordinates needed for geo location.
I then wish to use Geo My WordPress to search by radius from the user's location. (I'd like CRED to geocode my posts and for Views to search by radius in a parametric search, but believe this is not possible).
I visited this URL: https://toolset.com/forums/topic/integrating-geo-my-wordpress-address-field/
I have also added the following to my 'functions.php' but although I don't receive any errors, it does not seem to be working:
add_action("cred_save_data_96", "save_data_for_form_with_id_96",10,2);
function save_data_for_form_with_id_96( $post_id, $form_data ) {
if ( function_exists( 'gmw_pt_update_location' ) ) {
$args = array(
'street' => get_post_meta( $post_id, 'wpcf-address-1', true),
'city' => get_post_meta( $post_id, 'wpcf-address-3', true),
'state' => get_post_meta( $post_id, 'wpcf-county', true),
'zipcode' => get_post_meta( $post_id, 'wpcf-postcode', true),
);
gmw_pt_update_location( $args );
}
}
(I am not sure if I need to change "10,2);" in the 'add_action' line above?
I expected to see:
1) Geo My WordPress Search show these records in search results.
2) Somehow (have not tried this yet) have Views show these records on a Google Map.
Sorry, I am no expert when it comes to programming. Any help will be greatly appreciated!