Support » Fixing WordPress » [Community] Restrict REGISTRATION to specific EMAIL adresses

  • Theo_1

    (@theo_1)


    Hey everyone,

    I am building a community website for my school, and I need to custom the wordpress registration process so that only those who have a “@myschool.com” email adress can register.
    Could anyone help me find a way to do that ?

    I’d also like them to be able to use this email adress as their login.

    (I saw that a lot of topics didn’t get any answer, and I hope mine will. Thank you for your time, and don’t hesitate to poste if you have the slightest idea of any plugin or code i could use. Thanks a lot ! )

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theo_1

    (@theo_1)

    Thanks everyone for your quick answer.
    Just kidding, of course i didn’t get any answer of this forum.
    I am really looking for a forum that DOES answer people’s questions, if anyone knows any, please PM me : i’m sick of never getting answers…

    Anyway, I found the answer on another forum :

    You need to edit wp-login.php in some way, and add the following lines :

    `// Check that the e-mail address is an ‘@the_email_you_want.com’ adress
    if ( ! preg_match (‘#^[\w.-]+@the_email_you_want.com$#’,$user_email )) {
    $errors->add( ‘invalid_email’, __( ‘<strong>ERROR</strong>: Type your error message here ‘ ) );
    $user_email = ”;
    }
    // End of Ieseg verification`

    Sadly, this doesn’t work when you have some additional registration plugin enabled, such as the great “theme_my_login”, so I have the choice of either not using it, or forgetting about email domain verification.
    Maybe I could implement it in the “theme_my_login” plugin file, but I can’t find the corresponding fonction, and I won’t ask the question on this forum because I know it would be a loss of time ..

    Anyway, I hope that helped the many people who are in the same desperate situation 🙂

    Theo_1

    (@theo_1)

    I figured it out by modifying the Theme my login plugin, more precisely by deleting the function in the plugin that detects multisite.

    Thanks to everyone for answering, useful as always 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Community] Restrict REGISTRATION to specific EMAIL adresses’ is closed to new replies.