Skip to:

Domain whitelist for buddypress signup

  • lfeddern


    am trying to add a domain whitelist to the buddypress registration.

    all of the email address that will sign up to on my site will have the domain form with the XX varying in character length and number characters themselves.

    I basically would like to strip the domain of the entered email address down to the last 9 characters and then compare them to ( and return an error message if not identical, if not then allow the registration to continue.

    I found this code:

    // ====================================
    // Limit signup by banning domains
    function bp_as_restrict_signup_domains( $result ) {
     $banned = array(
     $error = 'Your email domain has been the source of spam. Please use another email address.';
     $email = $result['user_email'];
     $domain = array_pop(explode('@', $email));
    if ( in_array($domain, $banned))
     $result['errors']->add('user_email', __($error, 'bp-restrict-email-domains' ) );
     return $result;
    add_filter( 'bp_core_validate_user_signup', 'bp_as_restrict_signup_domains' );


    But this is to block certain domains rather than allow. Any ideas how to change it? and to strip out the characters before the last 9?

    Thanks for any help!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Domain whitelist for buddypress signup’ is closed to new replies.
Skip to toolbar