1. Home
  2. WP User Frontend Pro
  3. Integrations
  4. Pronamic Google Maps

Pronamic Google Maps

If you like Pronamic Google Maps and want to use along with WP User Frontend PRO, then there is a solution. You can still use the WP User Frontend’s Google Map custom field and using the function below, that would also update the pronamic plugins google map latitude and longitude and will work seamlessly.

function wpuf_pronamic_location( $post_id ) {
    $custom_field = 'address';

    if ( !class_exists('Pronamic_Google_Maps_Post') ) {
        return;
    }

    if ( isset( $_POST[$custom_field] ) ) {
        $address = $_POST[$custom_field];

        list( $def_lat, $def_long ) = explode( ',', $address );

        if ( $def_lat ) {
            update_post_meta( $post_id, Pronamic_Google_Maps_Post::META_KEY_LATITUDE, $def_lat );
        }

        if ( $def_long ) {
            update_post_meta( $post_id, Pronamic_Google_Maps_Post::META_KEY_LONGITUDE, $def_long );
        }

        if ( $def_lat && $def_long ) {
            update_post_meta( $post_id, Pronamic_Google_Maps_Post::META_KEY_ACTIVE, true );
        }
    }
}

add_action( 'wpuf_add_post_after_insert', 'wpuf_pronamic_location' );
add_action( 'wpuf_edit_post_after_update', 'wpuf_pronamic_location' );

Was this article helpful to you? Yes 7 No 4

How can we help?