How to avoid registration if e-mail has been not detected?

Hi there!

First of all - thanks for your job - this plugin is very useful and easy to use!

Now problem. I want to allow only users with correct e-mail detected register on my site.
I have chosen the "Yes, require the user to enter his email address manually and display this message"
option, but account is created even if e-mail was not specified. Records like this are created:

user_login = '-';
user_email = ''

How can I avoid this?
Is there any function that allows me to stop such account to be created?

Thanks in advance.

Best Answer

  • Fred_PinelFred_PinelMember
    Answer ✓
    If the manual email option is selected, then the user will have to enter a "valid" email.
    This email address is checked, via Wordpress's is_mail() function. (the email you provide in the example is valid).

    You can add your email validation, by adding function hooks to the following filters:
    add_filter('oa_social_login_filter_user_request_email', 'some_function', 2, 10);
    to add your additional checks for the email provided by the user when missing at Social Login registration,
    or (broader)
    add_filter('is_email', 'some_other_function', 3, 10);
    You need to write the functions, and add them to the functions.php of your theme.
    For the first (oa_...) function, you need to return a email address (and empty if not ok).
    For the second filter function, same but return false on unacceptable email.

    The '-' login is caused by some user login processing, to remove unwanted characters.
    See, bottom of page.

    Hope this helps.



Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.