Advertisement
chrishajer

Allow duplicate email address with User Registration

Jan 23rd, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2. // Author: David Smith
  3. // http://www.gravityhelp.com/forums/topic/disable-duplicate-email-check-snippet#post-91521
  4. // http://www.gravityhelp.com/forums/topic/multisite-register-users?replies=2#post-129695
  5. /**
  6. * Gravity Forms User Registration validates a number of fields. This snippet allows you to override the validation for
  7. * duplicate emails. This is useful when using the "Allow Multiple Accounts" plugin.
  8. */
  9. add_filter('gform_user_registration_validation', 'unvalidate_duplicate_email', 10, 2);
  10. function unvalidate_duplicate_email($form, $config) {
  11.     // update the 1 here to your form ID
  12.     if($form['id'] != 1)
  13.         return $form;
  14.        
  15.    
  16.     $email_field_id = rgars($config, 'meta/email');
  17.     foreach($form['fields'] as &$field) {
  18.         if($field['id'] == $email_field_id && $field['validation_message'] == 'This email address is already registered')
  19.             $field['failed_validation'] = false;
  20.     }
  21.    
  22.     return $form;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement