Osclass: A way to r...
 
Notifications
Clear all

Osclass: A way to restrict users by their email provider ?

2 Posts
1 Users
0 Reactions
742 Views
Alessandro Cagliostro
(@alessandro-cagliostro)
Posts: 212
Reputable Member
Topic starter
 

How to Block all mails with exceptions ?

 
Posted : March 19, 2017 14:49
Alessandro Cagliostro
(@alessandro-cagliostro)
Posts: 212
Reputable Member
Topic starter
 

Add this at the very bottom of your theme functions.php (take care not to leave blank lines after this).

You may continue adding mail providers to the array, separated by comma.

<?php
function cust_restrict_mail_providers() {

$authorized_providers = array(
‘fearp.usp.br’,
‘unip.com.br’,
‘unaerp.com.br’,
‘unicamp.com.br’
);
$current_provider = preg_replace(‘/^.*@(.*)$/i’, ‘$1’, Params::getParam(‘s_email’));

if (!in_array($current_provider, $authorized_providers)) {
osc_add_flash_error_message( _m(‘Your current email is not allowed’));
osc_redirect_to(osc_register_account_url());
}
}

osc_add_hook(‘before_user_register’, ‘cust_restrict_mail_providers’);
?>

 
Posted : November 18, 2017 20:21