bp_invites_member_invite_remove_registration_lock()
Allows invited users to register even if registration is disabled.
Description
Source
File: bp-invites/bp-invites-functions.php
function bp_invites_member_invite_remove_registration_lock() {
global $bp;
if ( ! bp_invites_member_invite_invitation_page() ) {
return;
}
if ( false === bp_is_active( 'invites' ) ) {
return;
}
if ( ! isset( $_GET['email'] ) || ! $email = urldecode( $_GET['email'] ) ) {
return;
}
// If the url takes the form register/?bp-invites=accept-member-invitation&email=username+extra%40gmail.com,
// urldecode returns a space in place of the +. (This is not typical,
// but we can catch it.)
$email = str_replace( ' ', '+', $email );
$args = array(
'post_type' => bp_get_invite_post_type(),
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => '_bp_invitee_email',
'value' => $email,
'compare' => '=',
),
),
);
$bp_get_invitee_email = new WP_Query( $args );
if ( !$bp_get_invitee_email->have_posts() ) {
bp_core_add_message( __( "We couldn't find any invitations associated with this email address.", 'buddyboss' ), 'error' );
return;
}
// To support old versions of BP, we have to force the overloaded
// site_options property in some cases
if ( is_multisite() ) {
$site_options = $bp->site_options;
if ( !empty( $bp->site_options['registration'] ) && $bp->site_options['registration'] == 'blog' ) {
$site_options['registration'] = 'all';
} else if ( !empty( $bp->site_options['registration'] ) && $bp->site_options['registration'] == 'none' ) {
$site_options['registration'] = 'user';
}
$bp->site_options = $site_options;
add_filter( 'bp_get_signup_allowed', '__return_true' );
} else {
add_filter( 'option_users_can_register', '__return_true' );
}
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.