Saturday, July 9th, 2016
Tags: Content, CSS, Justify, Left align, Property, Right align, text-align-last
Posted in CSS | No Comments »
Friday, July 1st, 2016
Add this code in to your functions.php to create a domain whitelist for user registrations.
add_action('registration_errors', 'sizeable_restrict_domains', 10, 3);
function sizeable_restrict_domains( $errors, $login, $email ) {
$whitelist = array(
'domain.com',
'website.com'
);
if ( is_email($email) ) {
$parts = explode('@', $email);
$domain = $parts[count($parts)-1];
$to = 'your@adminemail.com';
$subject = 'Subject of email';
$message = 'A user tried to register with the following email address: ' . $email;
if ( !in_array(strtolower($domain), $whitelist) ) {
$errors->add('email_domain', __('ERROR: You may only register with an approved email address.'));
wp_mail( $to, $subject, $message );
}
}
return $errors;
}
Tags: Blocking, Code, Domain, PHP, Registration, User, White list, WordPres
Posted in PHP, WordPress | No Comments »