HELP! restrict email domains! related to after login (set email) [important]!

i've noticed this issue and i need help in it.
for example:
if a user get log in from a social network, and the plugin will first add a new user with an example email address if the social network does not provide an email address. In the second step the plugin will ask the user to enter his real email.
so here is the problem!
if a user writes " " !!
it will be set as his/her email !!
if a user writes
it will be set as email !!
a user can writes whatever they want! it just has the form of ,,,@,,,.com

how can i stop this issue? control the email a user wants to submit (after login from a social network which do not provide email address so the user has to enter it manually) ?

i only want to allow my (logged in from social network) users to set gmail account (if the manually set email box appeared).
or only "" and "" is accepted.

how can i do this???

tnxxx a lot for your help.

Best Answer

  • Fred_PinelFred_PinelMember
    Answer ✓
    You can use the 'oa_social_login_filter_user_request_email' filter.
    In your theme's functions.php, add the following:
    add_filter('oa_social_login_filter_user_request_email', 'custom_email_filter', 10, 2); function custom_email_filter($email, $userid) { $valid = preg_match('/\@(gmail\.com|hotmail\.com)$/', $email); if ($valid === false or $valid === 0) { return ''; } else { return $email; } }
    Let us know how this works.



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.