Home Forums Plugin Support WP User Frontend Pro Geo my wp integration

This topic is: resolved

Tagged: , ,

This topic contains 7 replies, has 2 voices, and was last updated by  towhid 3 years, 11 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #52186

    Frederick
    Member
    Post count: 23

    Hi,
    I tried this code

    function gmw_update_location_via_wpuf(  $post_id ) {
    
    	//make sure we have post ID
    	if ( !$post_id )
    		return;
    
    	//change meta_field_name to the custom field of the address field
    	$address = get_post_meta( $post_id, 'cf_address', true );
    
    	//include geocoder file
    	include_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 function
    		gmw_pt_update_location( $args );
    	}
    }
    //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 );
    

    Ater upgraded on pro version i modified

    add_action('wpuf_edit_post_after_update', 'gmw_update_location_via_wpuf', 10, 1 );

    but it doesn't worked i don't have the custom posts types locations on the map.
    Thank you for help

    #52214

    towhid
    Participant
    Post count: 4505

    Hello Frederick,

    Where have you processed this code? In function.php?

    Also please let me know what is the function of this code?

    Thanks

    #52224

    Frederick
    Member
    Post count: 23

    Hi the aim of this code is to get meta of the address custom field for use by geo my wp plugin.
    This plugin can display all my custom posts types on a map.

    I tried to put it in functions.php and in a custom plugin but it doesn't work since i've been upgrade to the pro version of wpuf

    #52268

    towhid
    Participant
    Post count: 4505

    Hello Frederick,

    Please read the following documentation about the integration of WPUF with Geo Plugin.
    http://docs.wedevs.com/wp-geo/

    If you need any other assistance from me please let me know. I am here to help you.

    Thanks

    #52328

    Frederick
    Member
    Post count: 23

    Hi i tried with you code without succes because i don't know how to set WPGEO data to gmw fields. The only way i know is to fill the address field.

    This is my code :

    function gmw_update_location_via_wpuf(  $post_id ) {
    
    	//make sure we have post ID
    	if ( !$post_id )
    		return;
        
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
            return;
        }
    
    	//change meta_field_name to the custom field of the address field
    	$address = get_post_meta( $post_id, 'adresse', true );
        
        if ( empty( $address ) )
                return;
        
    	//include geocoder file
    	include_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_title'      => get_the_title( $post_id ),
    				'address'         => $address
    		);
    		//run geocoder function
    		gmw_pt_update_location( $args );
    	}
    }
    //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_edit_post_after_update', 'gmw_update_location_via_wpuf', 10, 1 );

    Tha address field is correctly filled when post is created but not while updating.

    Thank you for helping

    #52385

    towhid
    Participant
    Post count: 4505

    Hello Frederick,

    I did not get you completely. Can you please provide me with screenshot also a proper description about the problem.

    Thanks

    #52654

    Frederick
    Member
    Post count: 23

    Hi, thank you for you replies, the problem seems to come from gmw plugin. I installed the new beta version and the job is done better.

    Thank you again

    #52732

    towhid
    Participant
    Post count: 4505

    Hello Frederick,

    I am very happy to know that the you have solved the problem. I am going to mark this topic as resolved and closed.

    Thanks

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Geo my wp integration’ is closed to new replies.