Embed Snippet on Your Site
MemberPress: Restrict Email Domains on Registration
This code snippet will limit the membership registration to only the allowed list of email domains. Thus, users will be able to register for memberships only with email addresses that match allowed email domains.
The sample code snippet will allow registration only to users with gmail.com and hotmail.com email addresses.
The code snippet will display the “Your email domain is blocked from signing up.” error message if registration is attempted with the email address that doesn’t match the allowed email domains list.
The code snippet should be updated by replacing the current list of domains ('gmail.com', 'hotmail.com') with the actual list of allowed email domains in this line:
$allowed_email_domains = array('gmail.com', 'hotmail.com');
To edit the error message, modify the "Your email domain is blocked from signing up." text in this line:
$errors[] = 'Your email domain is blocked from signing up.';
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Comments