Alternative Registration Workflows
We are currently working on a documentation reboot, here’s the new home of the best accurate docs (WIP). You’re very welcome to contribute to it.
Updated documentation for this section is available here.
By default, registration in BuddyPress follows this workflow:
A site administrator can enable registration by checking “Anyone can register” on the WP Admin > Settings > General options screen.
If registration is enabled, then site visitors can sign up for an account using the registration form.
Once the registration form has been submitted, the user will be sent an activation email that verifies that the user’s email address is legitimate.
Once the user activates her account, she will be able to login using the username and password she specified on the registration form.
Changing the Registration Process
You can change the default BP registration flow by allowing member invitations and/or requiring membership requests. These features can be used separately or together to change who is allowed to join your site.
Invitations
Invitations can be used when public registration is open to help grow your site’s membership or when public registration is closed to only allow membership by referral from an existing member.
Enable membership invitations by visiting the WP Admin > Settings > BuddyPress > Options screen.
Your site members can send invitations from their user profiles.
The invited member will receive an email containing a link to the registration form.
Even if you have disabled public registration, valid invitation holders will be able to access the form using the link in the email.
Once the user registers, the account will be activated immediately (responding to the invitation has already verified the user’s email address) and will be able to log in to the site.
Membership Requests (available in BuddyPress 10)
Enabling membership requests interrupts the registration process by preventing the activation email from being sent automatically, and instead requires that a site administrator manually review and approve each account request.
Enable membership requests by visiting the WP Admin > Settings > BuddyPress > Options screen. Note that public registration must be disabled for requests to be activated.
Then, visitors will be able to visit the registration form to submit a membership request.
When a new request is submitted, the site admins will receive a site notifications and an email. The email can be disabled via the user’s email preferences screen.
The link in the email or site notification will take the administrator to an approval screen where she can review the submitted membership request and choose to confirm it.
The administrator can also visit the Manage Pending Memberships screen at WP Admin > Users > Manage Pending Memberships.
Hovering over a row will reveal the following actions available to the admin:
- “Activate” will activate the user immediately without requiring that they validate their email.
- “Approve Request” or “Resend Approval” takes you to the confirmation screen before being able to send the activation link to the desired pending request. You can only send the activation email once per day.
- “Profile Info” will display extended profile information for the request.
- “Delete” allows you to delete a pending account from your site. You will be asked to confirm this deletion.
If the administrator approves the request, the submitter will receive an activation email and can complete their registration.
If the administrator deletes the request, the submitter will receive an email telling them that their request has been declined.
Membership Requests – Automatically approving some membership requests.
There are cases where every user that satisfies some criteria should be granted access immediately and not require manual approval. For example, if you are building a site for students and staff at a specific school, you might want to approve every request that comes in from any user with a my-school.edu
email address. You can do this by adding a filter like the following to your bp-custom.php
file or your theme’s functions.php
file:
<?php
/**
* If a user submits a site membership request, but has a
* 'my-school.edu' email address, bypass the manual approval of the request.
*
* @param bool $send Whether or not this membership request should be approved
* immediately and the activation email sent.
* Default is `false` meaning that the request should be
* manually approved by a site admin.
* @param array $details The details of the request.
*/
function bpcodex_auto_approve_some_requests( $send, $details ) {
// We'll need the prospective user's email address.
if ( empty( $details['user_email'] ) ) {
return $send;
}
$email_parts = explode( '@', $details['user_email'] );
// If the email address is one of ours, approve the request.
if ( ! empty( $email_parts[1] ) && 'my-school.edu' === $email_parts[1] ) {
$send = true;
}
return $send;
}
add_filter( 'bp_members_membership_requests_bypass_manual_approval', 'bpcodex_auto_approve_some_requests', 10, 2 );