• Resolved Michael

    (@bazzarello)


    Hello, how are you?

    I am using the code below to integrate GEO my WP with the WP User Frontend plugin.

    When a new post is created it works very well. But when editing the post the address does not update automatically. In the field of WPUF it is updated, but in the field of GEO my WP, the first registered address always remains.

    Can you help me with that?

    =======
    CODE

    function gmw_update_location_via_wpuf( $post_id ) {

    // make sure post ID exists.
    if ( ! $post_id ) {
    return;
    }

    // verify updater function.
    if ( function_exists( ‘gmw_update_post_location’ ) ) {

    // change meta_field_name to the custom field of the address field.
    $address = get_post_meta( $post_id, ‘cf_address’, true );

    //run geocoder function
    gmw_update_post_location( $post_id, $address );
    }
    }
    //update data of new post
    add_action(‘wpuf_add_post_after_insert’, ‘gmw_update_location_via_wpuf’, 10, 1 );
    //update data when post updated
    add_action(‘wpuf_add_post_after_updated’, ‘gmw_update_location_via_wpuf’, 10, 1 );

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Michael

    (@bazzarello)

    I managed to solve it by replacing the last line with this one:

    add_action( ‘wpuf_edit_post_after_update’, ‘gmw_update_location_via_wpuf’, 10, 1 );

    see –> wpuf_EDIT

    thanks

    The Address Field of Wedevs changes.
    You need to split it before using the hook.

    The field is now, address, lat, lng

    Cheers,
    Denis

    Thread Starter Michael

    (@bazzarello)

    Very Thanks!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Update when post updated WPUF’ is closed to new replies.