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.

Automatic deletion of specific form data after submission

  1. Hi there,
    Bit of an usual question. A client of mine has a will planning form which contains user defined financial information. The form states to the end user that none of this information will be stored by my client. So they've asked whether there's an option to have certain fields automatically deleted after submission. I can't think of how this would be possible for individual fields and even deleting the whole form apart from a admin user going in and deleting the whole entry from within Wordpress database. So was just wondering if there were any options I'm unaware of to tackle this.
    Many thanks,
    Phil

    Posted 11 years ago on Tuesday March 26, 2013 | Permalink
  2. David Peralty

    You could use gform_after_submission to delete the entry or elements of it. You'd require some intermediate level PHP knowledge to do this. Others on the forum have done this before and you might be able to find some code samples or some people that have the knowledge you need.

    http://www.gravityhelp.com/documentation/page/Gform_after_submission

    Posted 11 years ago on Tuesday March 26, 2013 | Permalink
  3. Thanks David. That's really helpful. I'll take a look at some of the code samples. Just so I understand this correctly, if I use gform_after_submission to strip out specific fields after submission, by definition does this mean these fields will be removed from all confirmation emails and the entries log in the database? My client has since asked if the code could be more specific and only remove particular fields from the admin confirmation email and database entries log but send the entire form with all fields included for the end user confirmation email. Many thanks, Phil

    Posted 11 years ago on Wednesday March 27, 2013 | Permalink
  4. The gform_after_submission hook will run after the entry is stored and notifications have been sent. So, the entry will be stored in its original format with all the fields, and the notification will be sent with all the fields. You will be using the gform_after_submission hook to delete just specific fields from the entries. Does that clarify things?

    Posted 11 years ago on Sunday March 31, 2013 | Permalink
  5. Thanks Chris. That's great!

    Posted 11 years ago on Thursday April 4, 2013 | Permalink
  6. You're welcome.

    Posted 11 years ago on Monday April 8, 2013 | Permalink