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.

Would Like Entries Go Directly To Email | NOT to Database

  1. Greetings All,
    This is a question regarding this post.

    I have many forms on my site, and there really is only one form (Contact Form) in which, I do not want the entries to stay in the database. Does the above code delete all forms submissions? How do I get it so that it ONLY deletes the Contact Form entries and not all the other form entries (Which need to stay on the database).

    Cheers,
    Laura

    Posted 7 years ago on Sunday January 6, 2013 | Permalink
  2. On line 3 of this code http://pastie.org/1435911 the _1 specifies that the filter will apply only to entries from form one. You can recreate this code multiple times, once for each form on your site.

    If you want to do the opposite, and apply it to all forms EXCEPT your contact form, you want to do something like this instead, for the first three lines (please test this before installing it in a production environment):

    [php]
    add_action('gform_post_submission', 'remove_form_entry', 10, 2);
    function remove_form_entry($entry, $form){
        // update the 17 here to the ID of the form you
        // do NOT want to delete the entries of
        // i.e. your contact form
        if($form['id'] == 17) {
            return;
        }
        // if this is not form 17, delete the entry
        // continue with the original code after this line
        global $wpdb;
        // etc...
    Posted 7 years ago on Monday January 7, 2013 | Permalink
  3. Thank you very much Chris, your help has been truly appreciated.

    Posted 7 years ago on Tuesday January 8, 2013 | Permalink

This topic has been resolved and has been closed to new replies.