Site icon Hip-Hop Website Design and Development

Prohibit consumer registration to emails on a single area

I would like to permit consumer registrations just for these with electronic mail addresses on a single area. I’ve examined a number of common expressions and this one works effectively in a regex sandbox setting, however as quickly as I put it into my features.php file, it merely rejects all registrations – even electronic mail addresses on the right area (with the error message under, so it is positively this conditional that is breaking it). Am I:
a) really doing one thing silly within the regex, even tho the web regex testers say it is doing what I would like?
b) utilizing a regex syntax that WordPress would not help?
c) screwing up one thing in the remainder of the perform?
d) misunderstanding the codex, and it is not so simple as simply including this to features.php?

add_filter( 'registration_errors', 'myplugin_registration_errors', 10, 3 );
perform myplugin_registration_errors( $errors, $sanitized_user_login, $user_email ) {

    if (!preg_match('( |^)[^ ]+@mydomain.co.uk( |$)', $user_email )) {
    $errors->add( 'invalid_email', __( 'ERROR: Solely legitimate "mydomain" electronic mail tackle is allowed.' ));
    $user_email = '';
    }

    return $errors;
}

BTW, I am conscious that the common expression I’ve used would not totally take a look at {that a} legitimate electronic mail tackle has been entered – all I would like it to do is verify that the area is precisely proper (and clearly this is not the ‘actual’ one!!)

I additionally tried the answer in a earlier publish (2011) nevertheless it merely broke my entire web site 🙁

I have been looking at this so lengthy now, it could possibly be blindingly apparent and I would not see it…

Many thanks!