@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.
@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.)
@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.
@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.
@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?