Forums › WP Users Geolocation › Can't seem to trigger action
- This topic has 4 replies, 2 voices, and was last updated 6 years, 2 months ago by
Eyal Fitoussi.
-
AuthorPosts
-
May 12, 2016 at 2:55 pm #52163
subease
MemberHi there,
I am trying out your plugin, looks totally awesome and just want I need. I have an “address” field that is a post_meta field to my users. I followed in the instructions on: http://docs.tempform.wpengine.com/geo-wp-wp-user-front-end-integration/ but I can’t seem to trigger ‘gmw_update_location_via_wpuf’ when I submit a form that updates the user’s address. I did validate that the following two call where made (as part of my functions.php):
add_action(‘wpuf_add_post_after_insert’, ‘gmw_update_location_via_wpuf’, 10, 1 );
add_action(‘wpuf_add_post_after_updated’, ‘gmw_update_location_via_wpuf’, 10, 1 );Any help would be great!
Jay
Below is the code I am using.
12345678910111213141516171819202122232425262728293031323334if (! function_exists('gmw_update_location_via_wpuf')) {function gmw_update_location_via_wpuf($post_id) {// make sure we have post IDif (! $post_id)return;// change meta_field_name to the custom field of the address field$address = get_post_meta($post_id, 'address', true);if (empty($address)) {$address = $_POST['address'];}error_log("I am in gmw_update_location_via_wpuf");// include geocoder fileinclude_once (GMW_PT_PATH . '/includes/gmw-pt-update-location.php');if (function_exists('gmw_pt_update_location')) {// setup geocoder args$args = array('post_id' => $post_id,'post_type' => get_post_type($post_id), // change post_type to your own'post_title' => get_the_title($post_id),'address' => $address);// run geocoder functiongmw_pt_update_location($args);}}// update data of new postadd_action('wpuf_add_post_after_insert', 'gmw_update_location_via_wpuf', 10, 1);// update data when post updatedadd_action('wpuf_add_post_after_updated', 'gmw_update_location_via_wpuf', 10, 1);}May 12, 2016 at 10:34 pm #52170Eyal Fitoussi
MemberHI Jan,
I did validate that the following two call where made (as part of my functions.php):
add_action(‘wpuf_add_post_after_insert’, ‘gmw_update_location_via_wpuf’, 10, 1 );
add_action(‘wpuf_add_post_after_updated’, ‘gmw_update_location_via_wpuf’, 10, 1 );I did you validate that? The only way ( that I know of ) to validate that a hook fires is if the function attached to it being executed. BUt you also said that the function is not trigged. So I am a bit confused.
May 13, 2016 at 1:36 am #52186subease
MemberSorry I wasn’t clear, what I was trying to say is that I validated that the “add_action” calls were made and the function calls were added to the ‘wpuf_add_post_after_insert’ and ‘wpuf_add_post_after_updated’ actions.
May 14, 2016 at 11:24 am #52203Eyal Fitoussi
MemberIf the functions is not being executed at all it might has to do with the “wpuf_add_post_after_insert” and “wpuf_add_post_after_udpate actions.
I haven’t tested WP User Front-End plugin for a while but I suggest you to ask the developers of the plugin if both actions “wpuf_add_post_after_insert” and “wpuf_add_post_after_udpate” still exist or maybe were replaced.
June 1, 2016 at 11:26 am #52548Eyal Fitoussi
MemberThis topic marked “Resolved” due to inactivity. If you wish to reply to this topic please change its status to “Not resolved” before replying.
-
AuthorPosts
You must be logged in to reply to this topic.