Allow only specific email providers Osclass Solution

If you want to Allow only some Specific email providers to Register on your website, so that you can stop unwanted fake emails to Register. Follow below steps.

Osclass Support and Solution
9. Aug 2022
95 views
Allow only specific email providers Osclass Solution

Allow only specific email providers Osclass Solution

I have added some popular email provider that is allow to Register , you can just paste this code into function.php file. (You can also add more email provider according to your requirement) 

 

 

function cust_restrict_mail_providers() {

    $authorized_providers = array(
        'gmail.com',
        'hotmail.com',
        'live.com',
        'yahoo.com',
        'outlook.com',
        'yandex.com',
        'bing.com',
        'microsoft.com',
        'mailbox.org',
        'mail.live.com',
        'rediff.com',
        'rediffmail.com'
    );
    $current_provider = preg_replace('/^.*@(.*)$/i', '$1', Params::getParam('s_email'));

    if (!in_array($current_provider, $authorized_providers)) {
        osc_add_flash_error_message( _m('Accounts not allowed'));
        osc_redirect_to(osc_register_account_url());
        exit;
    }
}

osc_add_hook('before_user_register', 'cust_restrict_mail_providers');

 

Comments

No comments has been added on this post

Add new comment

You must be logged in to add new comment. Log in
Find Best solution for your Osclass website.
Osclass Support and Solution
Categories
Books and Novels
Latest Books and Novels
Osclass Support and Solution
Osclass Support and Best Solution. Find Best answer here for your Osclass website.
Information
Check full Information about Electronic Items. Latest Mobile launch Date. Latest Laptop Processor, Laptop Driver, Fridge, Top Brand Television.
Pets Information
Check Details About All Pets like Dog, Cat, Fish, Rabbits and More. Pet Care Solution, Pet life Spam Information
Lately commented