• Resolved eric3d

    (@eric3d)


    I would like to know if the following is possible with this plugin. Basically, it requires email confirmation (to ensure a valid email was provided) and automatically approves the registration if the email address uses my client’s domain name.

    – User registers
    – User receives email confirmation
    – User clicks confirmation link
    if email contains “@clientdomain.com”
    – Registration is approved automatically
    else
    – Registration is pending (marked “email verified”) and requires admin to approve it manually

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Georgian Cocora

    (@raster02)

    Hello Eric,

    The exact scenario that you described is not possible, but we have some custom code which allows only certain domains to pass the registration process.

    The code is the following:

    function wppb_check_email_domain( $message, $field, $request_data, $form_location ){
       $list_of_blocked_domains = array( 'domain.com', 'mail.com', );
       $domain = substr(strrchr($request_data['email'], "@"), 1);
       if ( !in_array( $domain, $list_of_blocked_domains) ) {
          return __( 'The email domain you entered is not allowed on this website. Please try with a different email address.', 'profilebuilder' );
       }
     
       return $message;
    }
    add_filter( 'wppb_check_form_field_default-e-mail', 'wppb_check_email_domain', 20, 4 );

    You can add the allowed domains in the $list_of_blocked_domains variable and also change the message that users with the wrong email receive on the first line with return.

    This code can be added in your themes functions.php file or you can follow the instructions at the top of this page.

    Best Regards.

    Thread Starter eric3d

    (@eric3d)

    Thanks. I’ll look into this solution.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional registration approval based on email address’ is closed to new replies.