-
Author
-
August 9, 2013 at 04:25 #1220djgelatoParticipant
Hello, is it possible to set a domain extension requirement during the signup process? For example, I want only people that have an email based out of the uk so it will only accept emails that end in @whatever.co.uk or @whatever.eu, is this possible?
Thanks
August 9, 2013 at 15:32 #1227SQadminKeymasterHi,
Yes it is.
Just add this snippet to your sweetdate-child/functions.php file under wp-content/themes:COPY CODEfunction bp_restrict_email_domains_validate_user_signup( $result ) { if ( bp_restrict_email_domains_is_email_address_safe( $result['user_email'] ) ) $result['errors']->add('user_email', __('You cannot use that email address to signup.', 'kleo_framework' ) ); return $result; } add_filter( 'bp_core_validate_user_signup', 'bp_restrict_email_domains_validate_user_signup' ); function bp_restrict_email_domains_is_email_address_safe( $user_email ) { $allowed_names = array( '.co.uk', 'gmail.com' ); if ( is_array( $allowed_names )) { $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) ); foreach ( (array) $allowed_names as $allowed_domain ) { if ( strstr( $email_domain, $allowed_domain ) || ( strstr( $allowed_domain, '/' ) AND preg_match( $allowed_domain, $email_domain ) ) ) return false; } } return true; }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJune 14, 2015 at 11:32 #62687WhoweezParticipantGood day,
Does this include the process followed via signing up for a PMPro membership level.
I.e. I’d like visitor to signup for PMPro buddypress level (pmpro access to buddypress) – thus restricting only certain domain names to have access…
Please let me know if this is possible.
Thanks so much 🙂
Whoweez -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.