Skip to:
Content
Pages
Categories
Search
Top
Bottom

User registration based on a specific database of emails


  • krzysztofsw
    Participant

    @krzysztofsw

    Hi, can Buddypress only allow user registration, which email addresses have been previously added in wordpress?

Viewing 8 replies - 1 through 8 (of 8 total)

  • Varun Dubey
    Participant

    @vapvarun

    @krzysztofsw BuddyPress use the same user tables, all WordPress users will already be listed in BuddyPress member directory, and they cannot register again with same email id.


    krzysztofsw
    Participant

    @krzysztofsw

    @vapvarun It was about something else. I would like to allow registration only for e-mail addresses that I previously added manually in the panel.

    Yes, you can do any amount of extra validation on the hook bp_signup_validate.

    Something like this would probably do what you are trying to do:

    
    add_action( 'bp_signup_validate', function(){
    	$allowed_users = array( 'user1@domain.com', 'user2@domain.org' );
    	if ( isset( $_POST[ 'signup_username' ] ) && ! in_array( $_POST[ 'signup_username' ], $allowed_users ) ) {
    		$bp = buddypress();
    		$bp->signup->errors['signup_username'] = 'Sorry, your email address is not able to register with this site.';
    	}
    } );
    

    There are several examples on the web for doing things on that hook. (BuddyPress Registration Options does some things, for instance.)


    krzysztofsw
    Participant

    @krzysztofsw

    @dcavins Is there any more automated way? I have 2,500 addresses on the list 🙂

    There’s no tool built to do that, if that’s what you’re asking.


    krzysztofsw
    Participant

    @krzysztofsw

    @dcavins Or maybe it is possible for this hook to retrieve information from a csv file?

    Sure it’s possible, but you’d have to build it.


    krzysztofsw
    Participant

    @krzysztofsw

    @dcavins Building a csv file is not a problem. Can you tell me how can I attach a csv file to the code you wrote earlier?

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar