PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Potential Bug with gform_disable_post_creation

  1. tobaccordshow
    Member

    I'm using the gform_disable_post_creation action as the documentation specifies, but the post is being created anyway. My code:

    add_filter("gform_disable_post_creation", "disable_post_creation", 10, 3);
    function disable_post_creation($is_disabled, $form, $entry){
        return true;
    }

    Not sure why it's being ignored, but it doesn't even seem that the callback is being fired. Placing an echo call in there never appears.

    The form I'm using is not using the AJAX method and does use an image upload, in case that affects the solution.

    Posted 12 years ago on Tuesday October 11, 2011 | Permalink
  2. Which version of Gravity Forms are you using?

    Posted 12 years ago on Tuesday October 11, 2011 | Permalink
  3. tobaccordshow
    Member

    1.5.3

    Posted 12 years ago on Tuesday October 11, 2011 | Permalink
  4. Hi there, I couldn't recreate this issue on my end. The filter was triggered and able to prevent post creation in all my tests. Would you mind sending me a WP and FTP login so I can take a look at your setup and see what the conflict might be? Send to david@rocketgenius.com

    Posted 12 years ago on Tuesday October 11, 2011 | Permalink
  5. tobaccordshow
    Member

    Hi David,

    I responded with credentials. It looks like I do have the action firing evidenced by an echo string placed before the return true call. However, the post is still being created.

    Baffled here.

    Posted 12 years ago on Tuesday October 18, 2011 | Permalink
  6. tobaccordshow
    Member

    To further my bug testing, I commented out line 685 of form_display.php to ensure that the post could not be created regardless of the gform_disable_post_creation result. The entry was still created.

    Unless this filter is not used to disable entries (which I can't imagine what post it would be disabling if not for the entries), I cannot seem to get this to work.

    Posted 12 years ago on Tuesday October 18, 2011 | Permalink
  7. Same issue here! Didn't do as much debugging as tobaccordshow but posts get created.
    I'm using GF 1.6, just updated to the latest version today.

    I am using a GF form for creating and updating "Listings" (a custom post type).
    If a user already has a listing the GF gets prefilled with the values from the database and GF should not create a new listing but update the existing one.

    Prefill works, listing creation also works, but I can't get gform_disable_post_creation to work.

    Code summary: In the page that contains the form and before the form displays, I check for exisiting listings. If we have one we get the prefill and I am using:
    `add_filter("gform_disable_post_creation_1", "disable_post_creation", 10, 3);
    function disable_post_creation($is_disabled, $form, $entry){
    return true;
    }`

    Is this the right location? Or is anything wrong with the code?

    Posted 12 years ago on Thursday November 3, 2011 | Permalink
  8. Hi Tracy,

    Try adding the "gform_disable_post_creation" filter in the gform_pre_submission hook instead. You will need to run your check again to verify whether the post creation should actually be disabled.

    Posted 12 years ago on Thursday November 3, 2011 | Permalink