Embed Snippet on Your Site
MemberPress: Restrict Signups for EU-Based Users
This code snippet will restrict signups for EU-based Users on MemberPress registration pages. Additionally, it ensures that the country field is mandatory during signup.
To update the error message displayed when a user from the restricted country tries to register, adjust the Sorry, signups are not allowed from EU countries. error text on this line:
$errors[] = 'Sorry, signups are not allowed from EU countries.';
To update the error message displayed when a user tries to register without selecting a country, adjust the "Country selection is required to proceed." error text on this line:
$errors[] = 'Country selection is required to proceed.';
The list of excluded countries can be modified by removing any two-letter country code on these lines:
$eu_countries = array(
'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE',
'EL', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT',
'RO', 'SK', 'SI', 'ES', 'SE'
);
Removing any two-letter country code will allow registration for users based in that country.
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Comments