I have a site option where users can enter domains to “whitelist” registrations from. What I’d like to do is hook into the invite/create user flow to verify the new user’s domain from their email address matches one of the domains in the site options.
Does anyone know if this is possible, or how to go about doing that?
Add clarification:
This would need to look at the email address field within the invite process and I assume strip out everything but the root domain. Then validate the domain is included in an array from blog options. So I guess the start of it would be something like this?
function dwsl_whitelistreg() {
$settings=get_option( 'school_settings');
if (in_array( ENTEREDEMAILADDRESS , $settings[whitelist])) {
ACTION TO SUBMIT USER
}
else {
echo "I'm sorry the user's email address does not match a domain given by the school. If you feel this is an error, please email support@dewsly.com";
}
}
add_filter('wpmu_signup_user', 'dwsl_whitelistreg');
It is possible to hook into
wpmu_validate_user_signup
, which returns the$result
of the sign-up process. Add another check for the email domain whitelist and add an error if not allowed.PS: nice trick with the fake filter
wpmu_signup_user
😉