• I have a requirement to only allow 1 entry by the same person every 24 hours into a sweepstakes. I have updated the WR ContactForm existing validation that checks for duplicates (in /wr-contactform/libraries/gadget/contactform-frontend.php) to qry the CFDB table for an existing entry WITHIN 24 HOURS (based on email addr) and set a Session parm. I then display the correct page (thank you or error) upon submission – this is all fine. Of course the data is already saved at this point.
    I do not want to save the form data on error in the CFDB table. Where is the best place to insert code that first checks the Session parm BEFORE the data gets saved? Also, if some form fields/records get written BEFORE this email validation will I run into a problem on the data export with the GROUP BY methods that display the data (a single “record” of data actually being a grouped set of records in the DB)?
    Thank you

    https://www.ads-software.com/plugins/contact-form-7-to-database-extension/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    CFDB hooks into the wr_contactform_before_save_form hook to save. It runs the CFDB save then runs the WR save immediately after.

    You should ask on the WR Contact Form forum: You have a validation to run to determine if a form submission is valid. How can you hook into WR Contact form to cause and error and prevent saving?

    Thread Starter Pat G

    (@pat-g)

    Michael, thank you for the immediate reply – very much appreciated! I wouldn’t mind the duplicates bypassing the CFDB table but still have WR go through it’s normal process to the thank you page (where I redirect to error page based on the session parm). This specific error the client does not want the error to come back to the form, similar to a required field for example. They want to send them to the error page.
    I will definitely check out the WR forum, but if I have to come back to the CFDB plugin, it it just the saveFormData funtion I would need to worry about?
    Thanks again for your time.

    Plugin Author Michael Simpson

    (@msimpson)

    Whether the error goes to the form or to an error page is a WR Contact Form question.

    If you want to bypass saving to CFDB in certain cases, there is a discussion about that in this thread: https://www.ads-software.com/support/topic/is-it-a-way-to-dont-saveexport-row-with-exisinting-field-email?replies=6

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Contact Form DB – Save/Not Save data based on Session Parm’ is closed to new replies.