GEO my WP Support

Use this forum for technical support and general questions related to GEO my WP plugin and its core add-ons only. For technical support and general questions related to any of the premium extensions please open a new premium support ticket.

[Not resolved]Post Types add-on bug

Forums Support Post Types add-on bug

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #54667
    Mark
    Member

    Hi,

    I’m experiencing a very strange bug.

    In file geo-my-wp/plugins/posts/loader.php the file gmw-pt-functions.php is included after a if( !is_admin() || defined( ‘DOING_AJAX’ ) ) check. However, in this gmw-pt-functions.php file is a function ‘gmw_pt_delete_location’ which is hooked to ‘before_delete_post’.

    So now, when deleting a post the location is not deleted from wp_places_locator table, because gmw-pt-functions.php is not included because we are in the back-end (is_admin())

    Then on to the bug; When I’m on a single post page of a post type, and I submit a gravity forms form on this page, the location is deleted in the wp_places_locator table. I’ve tracked this to the gmw_pt_delete_location function. So somehow, it triggers that action.

    Any ideas?

    #54668
    Mark
    Member

    Update:

    I’ve changed function gmw_pt_delete_location as follows:
    OLD CODE:

    NEW CODE:

    This fixes the bug

    #54673

    Hello Mark,
    IN the “OLD CODE” you posted above you have “$post_id->ID” which should not be the case. In GEO my WP plugin it should be $post->ID. I am not sure why you got $post_id->ID.

    Anyway, the solution you posted above, which is using the “$post_id” by passing it as an argument to the function, is correct. But the original function of GEO my WP which is $post->ID should work as well.

    Which version of GEO my WP are you using?

    #54681
    Mark
    Member

    Hi Eyal,

    Sorry, my mistake, I accidently edited the “OLD CODE” part! I’m running latest version 2.6.6.1, but I accidently changed the $post->ID to $post_id->ID.

    However, this bug still exists; On a single post page which has geolocation enabled, if I submit a gravity forms form on this page, the location gets deleted from the wp_places_locater table.

    I’m thinking this; after form submission, somewhere along the line the ‘before_delete_post’ hook is called by who knows what. And because you are using the global $post to get the postID in the ‘before_delete_post’ hook and we are on a single post page, it uses the postID of that single post. While probably the postID that’s passed as an argument to the delete function, is another postID

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

You must be logged in to reply to this topic.