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.

Verify if email is duplicate before submitting the form

  1. Hello,

    From this page:

    http://gm-studio.co.uk/model-contest/photo-contest/

    if the user is logged in, there is a link to go to this page:

    http://gm-studio.co.uk/model-contest/upload-your-pictures/

    Where (if the user is logged in) is possible to fill a form where the email field have to be unique, this is working well.

    I would like to know if there is a simple php code to add in the first page able to verify if there is already an entry in the database submitted bu the logged user, in that case the link to the form page doesn't appear?

    I have already added the php to verify if the user is logged in, but i don't know how verify that his email is already in one entry in the database.

    Thanks for your help

    Giorgio

    Posted 13 years ago on Wednesday February 2, 2011 | Permalink
  2. You can theoretically use the same function that Gravity Forms uses to test for duplicate entry values. It's called is_duplicate() and you can find it in forms_model.php on line 1594.

    Posted 13 years ago on Wednesday February 2, 2011 | Permalink
  3. Thanks David, i'm going to have a look at it, is there any way to make that function visiable insidede the page i want to call it? do i need to create an hook in my page theme template?

    thanks Giorgio

    Posted 13 years ago on Tuesday February 15, 2011 | Permalink
  4. You would have to edit forms_model.php and look for the is_duplicate() function and copy-n-paste and repurpose the code for your needs. There isn't a way to access it yourself from the forms_model code. You'd have to duplicate that function and repurpose it for your needs.

    Posted 13 years ago on Tuesday February 15, 2011 | Permalink
  5. Hi Carl,

    Sorry again :(

    I'm trying to understand the function but can't get much out of it.

    My first issue is how to get the user email from wordpress? Than to pass it to the is_duplicate?

    Is it possible for you to give me a simple example?

    Thanks

    Giorgio

    Posted 13 years ago on Friday February 18, 2011 | Permalink
  6. Hi Giorgio,

    Here is a snippet that uses Gravity Forms' is_duplicate() function to check if a value is already stored in the GF entry details table for a specific field of a specific form. I've noted in the code what will need to be changed to update this for your setup.

    http://pastie.org/1579958

    Posted 13 years ago on Friday February 18, 2011 | Permalink
  7. Hi David!

    Thanks! :)

    I have copied the functions is_duplicate, get_lead and get_lead_table_name into my functions.php them file. Than i have modified your code into the page the link appear and it work great!!!!!!!

    Thanks again for your support!

    Posted 13 years ago on Saturday February 19, 2011 | Permalink
  8. My pleasure, glad this worked for you. :)

    Posted 13 years ago on Saturday February 19, 2011 | Permalink

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