Title: stcc's Replies | WordPress.org

---

# stcc

  [  ](https://wordpress.org/support/users/stcc/)

 *   [Profile](https://wordpress.org/support/users/stcc/)
 *   [Topics Started](https://wordpress.org/support/users/stcc/topics/)
 *   [Replies Created](https://wordpress.org/support/users/stcc/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/stcc/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/stcc/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/stcc/engagements/)
 *   [Favorites](https://wordpress.org/support/users/stcc/favorites/)

 Search replies:

## Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] [Plugin: Contact Form 7 to Database Extension] How to get rid of the duplicates in the database](https://wordpress.org/support/topic/plugin-contact-form-7-to-database-extension-how-to-get-rid-of-the-duplicates-in-the-database/)
 *  Thread Starter [stcc](https://wordpress.org/support/users/stcc/)
 * (@stcc)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-to-database-extension-how-to-get-rid-of-the-duplicates-in-the-database/#post-2950289)
 * Hi Nitesh:
 * Thank you very much! I will take a look.
 * stcc
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Fast Secure Contact Form] [Plugin: Fast Secure Contact Form] Check email field in the db for error (using CF to DB ext)](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/)
 *  [stcc](https://wordpress.org/support/users/stcc/)
 * (@stcc)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/page/2/#post-2572830)
 * Hi Daniele:
 * The form is not public. However I can give you access to it. I can email you 
   the user name/password if you don’t mind to give me your contact information.
   Please email me at: [leeou76@yahoo.com](https://wordpress.org/support/users/stcc/replies/leeou76@yahoo.com?output_format=md)
 * I really appreciate your kind help!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Fast Secure Contact Form] [Plugin: Fast Secure Contact Form] Check email field in the db for error (using CF to DB ext)](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/)
 *  [stcc](https://wordpress.org/support/users/stcc/)
 * (@stcc)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/#post-2572828)
 * Hi Daniele:
 *  You have written very great and useful codes.
    The field name and the form title
   are all correct. … I am not sure why it is not working. So confused. Thank you
   very much!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Fast Secure Contact Form] [Plugin: Fast Secure Contact Form] Check email field in the db for error (using CF to DB ext)](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/)
 *  [stcc](https://wordpress.org/support/users/stcc/)
 * (@stcc)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/#post-2572826)
 * Logically it seems right for me. I am not sure if there are syntax errors inside
   the codes…. very confused by it not working right….
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Fast Secure Contact Form] [Plugin: Fast Secure Contact Form] Check email field in the db for error (using CF to DB ext)](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/)
 *  [stcc](https://wordpress.org/support/users/stcc/)
 * (@stcc)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/#post-2572825)
 * here is the link for the above code:
 * [http://pastebin.com/Ev1CSrfC](http://pastebin.com/Ev1CSrfC)
 * Thank you!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Fast Secure Contact Form] [Plugin: Fast Secure Contact Form] Check email field in the db for error (using CF to DB ext)](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/)
 *  [stcc](https://wordpress.org/support/users/stcc/)
 * (@stcc)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/#post-2572823)
 * Here are the codes I slightly modified based on your code:
 * function is_clicker_already_returned($myclicker){ // Check if a clicker already
   returned
    global $wpdb; define (‘FORM_NAME’, ‘Clickers Inventory’); define (‘
   FIELD_NAME’, ‘Clicker’); $query=”SELECT submit_time, if(field_name='”.FIELD_NAME.”‘,
   field_value, null ) AS ‘”.FIELD_NAME.”‘ FROM wp_cf7dbplugin_submits WHERE form_name
   = ‘”.FORM_NAME.”‘ AND field_value='”.$myclicker.”‘ “; $myrows = $wpdb->get_results(
   $query, ARRAY_A ); if (is_array($myrows) && count($myrows)){ return true; //clicker
   already exists in the db }else{ return false; // first time with this email }}
   function duplicate_clicker_validation_filter($result,$tag){ define (‘FIELD_NAME’,‘
   Clicker’); $type = $tag[‘type’]; $name = $tag[‘name’]; if($name == FIELD_NAME){//
   Only apply to fields with the form field name of “clicker” $the_value = $_POST[
   $name]; if(is_clicker_already_returned($the_value)){ //An clicker with this barcode
   has already been returned) $result[‘valid’] = false; $result[‘reason’][$name]
   = ‘clicker already returned.’; } } return $result; } add_filter(‘wpcf7_validate_clicker’,’
   duplicate_clicker_validation_filter’, 10, 2); // Email field add_filter(‘wpcf7_validate_clicker*’,‘
   duplicate_clicker_validation_filter’, 10, 2); // Req. Email field
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Fast Secure Contact Form] [Plugin: Fast Secure Contact Form] Check email field in the db for error (using CF to DB ext)](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/)
 *  [stcc](https://wordpress.org/support/users/stcc/)
 * (@stcc)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/#post-2572822)
 * By the way, if I code the above codes to the function.php file, I can just add
   them at the end of the function.php file, and I don’t need to put the open and
   close php tags, right? (only if I create a new php file to put the codes in, 
   I will need the open and close php tags)? Thank you!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Fast Secure Contact Form] [Plugin: Fast Secure Contact Form] Check email field in the db for error (using CF to DB ext)](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/)
 *  [stcc](https://wordpress.org/support/users/stcc/)
 * (@stcc)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/#post-2572821)
 * Hi Daniele:
 * Thank you so much for your quick reply! I have put your code in the function.
   php (in the theme folder), and have modified the form name, field name, error
   message etc according to my database structure. However, when I tried to submit
   the entry from my form, why it still takes/adds the duplicate entry into the 
   database although the same entry is already in the database? I am a little bit
   confused so I wonder if that is the steps I should follow:
 * change your codes according to my formname/field
    put the code in the function.
   php then I am all set to test the form entry?
 * Please correct me if I am wrong. Thank you so much!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Fast Secure Contact Form] [Plugin: Fast Secure Contact Form] Check email field in the db for error (using CF to DB ext)](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/)
 *  [stcc](https://wordpress.org/support/users/stcc/)
 * (@stcc)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-fast-secure-contact-form-check-email-field-in-the-db-for-error-using-cf-to-db-ext/#post-2572819)
 * Thank you very much for the codes! I am wondering how I should use these codes:
   do I put them in the function.php in the theme folder? how should I call it in
   the wordpress page/post so that it will work (and check if there are duplicates
   in the database for that particular field). I will greatly appreciate if you 
   can give me some suggestions. Thank you very much!

Viewing 9 replies - 1 through 9 (of 9 total)