Embed Snippet on Your Site
MemberPress: Restrict Email Patterns for All Memberships
This code snippet prevents users with specific email patterns from registering for any membership on the website.
When a user attempts to register with a restricted email pattern for any membership, the "Email addresses containing certain patterns are not allowed for this plan," error message will be displayed, preventing the registration from completing.
The sample list of specific email patterns ('xxx@gmail', 'xyz@', 'test@test') should be replaced with the actual patterns which should be restricted, in this line:
// Define the patterns to search for in email addresses
$blocked_email_patterns = array('xxx@gmail', 'xyz@', 'test@test');
To edit the error message, modify the "Email addresses containing certain patterns are not allowed for this plan," text in this line:
$errors[] = 'Email addresses containing certain patterns are not allowed for this plan.';
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Comments