The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Limit entries per email

Labels

This Discussion is public

Notifications

Hi,

I made a form for a contest and I would like to limit the entries per email.

  1. Users would be able to submit 1 entry in 24 hours. After the first entry, I want to display a error "You already participate today"
  2. Users can submit up to 24 times. After that, I want to display a error something like "You have reached the maximum entries for this contest"

Is there any setting for this or it has to be custom code? If is code and anyone can help me out, it would be appreciated.

Thanks

This is custom code and it will help if you understand how Formidable stores its data. Formidable follows the WordPress data model and stores its entry content in two tables. frm_items has the entry's header information. frm_item_metas stores the field content for the entry including email address. Each field item is a separate row in the frm_item_metas table. This may get complicated because the form_id is in the frm_items table. So your SQL queries have to join both tables on the actual entry_id that is the common link between both tables.

Once you capture the email address, you would query the tables for rows matching the email address, field id, and form id. You could check the max created_at field for the latest date/time entry to calculate the 24 hrs requirement. You would count the number of matching records for the 24 entry limit requirement.

This may best be handled by a jQuery Ajax call so you can get it real time as the email address is entered on the front end. While the requirements sound simple enough, implementing it requires some advanced programming skills, especially with the SQL. I suggest working out the SQL first, before trying to tackle the jQuery and PHP necessary for the Ajax.

Discussion closed.