bp_invites_member_invite_register_screen_message()
Checks if the email is connected to an active invite, populates the email address and shows the welcome message on the register page.
Description
Source
File: bp-invites/bp-invites-functions.php
function bp_invites_member_invite_register_screen_message() {
global $bp;
if ( ! bp_invites_member_invite_invitation_page() ) {
return;
}
if ( isset( $_GET['email'] ) ) {
$email = urldecode( $_GET['email'] );
} else {
$email = '';
}
?>
<?php if ( empty( $email ) ) : ?>
<div id="message" class="error"><p><?php _e( "It looks like you're trying to accept an invitation to join the site, but some information is missing. Please try again by clicking on the link in the invitation email.", 'buddyboss' ) ?></p></div>
<?php endif; ?>
<?php if ( $bp->signup->step == 'request-details' && ! empty( $email ) ) : ?>
<?php do_action( 'accept_email_invite_before' ) ?>
<script>
jQuery(document).ready( function() {
jQuery("input#signup_email").val("<?php echo esc_js( str_replace( ' ', '+', $email ) ) ?>");
});
</script>
<?php
$bp_get_invitee_email = bp_invites_member_invite_get_invitations_by_invited_email( $email );
$inviters = array();
if ( $bp_get_invitee_email->have_posts() ) {
while ( $bp_get_invitee_email->have_posts() ) {
$bp_get_invitee_email->the_post();
$inviters[] = get_the_author_meta( 'ID' );
}
}
$inviters = array_unique( $inviters );
$inviters_names = array();
foreach ( $inviters as $inviter ) {
$inviters_names[] = bp_core_get_user_displayname( $inviter );
}
if ( ! empty( $inviters_names ) ) {
$message = sprintf( _n( 'Welcome! You\'ve been invited to join the site by the following user: %s. Please fill out the information below to create your account.', 'Welcome! You\'ve been invited to join the site by the following users: %s. Please fill out the information below to create your account.', count( $inviters_names ), 'buddyboss' ), implode( ', ', $inviters_names ) );
echo '<aside class="bp-feedback bp-messages info"><span class="bp-icon" aria-hidden="true"></span><p>' . esc_html( $message ) . '</p></aside>';
}
?>
<?php endif; ?>
<?php
}
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.