Eliminate email validation for user registration

Hi
I have a form that I use for user registration. (with help of Registration add-on)

I want to disable email validation for this form in a way that submitting duplicate email is possible.
I found this solution in the gravity documentation. it says that I should use this code along with another filter.

Ignore ‘This email address is already registered’ error returned by WordPress

If you want to allow users to register on your site using already registered emails, you will need to use the function below along with the gform_user_registration_check_email_pre_signup_activation filter.

add_filter( 'gform_user_registration_check_email_pre_signup_activation', '__return_false' );

add_action("gform_user_registration_validation", "ignore_already_registered_error", 10, 3);
function ignore_already_registered_error($form, $config, $pagenum){
 
    // Make sure we only run this code on the specified form ID
    if($form['id'] != 1) {
        return $form;
    }
 
    // Get the ID of the email field from the User Registration config
    $email_id = $config['meta']['email'];
 
    // Loop through the current form fields
    foreach($form['fields'] as &$field) {
 
    // confirm that we are on the current field ID and that it has failed validation because the email already exists
    if($field->id == $email_id && $field->validation_message == 'This email address is already registered')
        $field->failed_validation = false;
    }
 
    return $form;
 
}

But it does not work for me. What I have done wrong here?

Hi Amin. Do you want to allow multiple WordPress user registrations with the same email address, or, if the same person who is already registered fills out your form with the same email address, you want to allow the form submission but skip registration?

I want to allow multiple WordPress user registrations with the same email address.

Hi Amin. Do you already have a plugin for WordPress that allows that? As far as I know, WordPress will only allow an email address to be used for one user. If you have a way to work around that, can you let us know what you are using? Thank you.

Hi Chris
I use Digits plugin for sign in and sign up. Users use their phone number to login to the site and the plugin automatically creates a user name from their phone number without email address.

I can also add users in bulk with help of Import and export users and customers without email.

In fact, I want to add users without email addresses. But the registration plugin does not allow this. After I read the documentation of the Gravity Forms registration plugin, I thought maybe it is possible to create users with a duplicate email. Then, I used the code but it didn’t work.
I think I am misunderstanding something.

Hi Amin. Thank you for the additional information. If you are using the Digits plugin for sign in and sign up, when are you using the User Registration Add-On for registrations?

Hi Chris
It’s a bit complicated and I need to elaborate on the whole process.

I sell online courses on my website. Users can buy and enroll in these courses.
I am also partnering with third-party agents to sell these courses. They create users and enroll them in online courses (without payment). But I don’t want to grant them access to the site backend and administrator panel. I plan to use a specific form for this purpose.

This is where the User Registration Add-on gets in. I designed a simple form (Just for Partner usage) that gets users’ names and phone numbers. When a partner provides this information and hits the submit button, the form automatically creates a user and enroll him/her on the course.

The form’s front end is simple (just 3 fields for first and last name and phone number) but in the background, I update some meta-keys using the Registration Add-On that enrolls them in a specific course and also links their phone number to their account. So, when the user signs in with his number, he has enrolled beforehand.

The only problem is that users do not have email addresses and the Registration Add-On does not let to create users without email.

I hope this information can help.

Is this possible? or you recommend leaving it?

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.