Skip Navigation

[Resolved] GeoCode CRED Address Fields Into Geo My WordPress

This support ticket is created 8 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 2 voices.

Last updated by Dat Hoang 8 years, 8 months ago.

Assigned support staff: Dat Hoang.

Author
Posts
#273116

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!

#273340

#1,
There is no problem in the code with CRED. Actually I don't understand what actions the function gmw_pt_update_location does.

I think you may miss one or more "required" parameter. Look at this: hidden link , if possible, please check with GeoMyWP support about this as well.

#2,
If you want to show these records on Google Maps. We have a built-in feature for that, please read our detailed guide here:
https://toolset.com/documentation/user-guides/map-wordpress-posts/