bp_members_invitations_get_registration_welcome_message()
Provide a more-specific welcome message if the new user is accepting a network invitation.
Return Return
(string) $message The message text.
Source Source
File: bp-members/bp-members-filters.php
function bp_members_invitations_get_registration_welcome_message() { $message = ''; if ( ! bp_get_members_invitations_allowed() ) { return $message; } $invite = bp_get_members_invitation_from_request(); if ( ! $invite->id || ! $invite->invitee_email ) { return $message; } // Check if the user is already a site member. $maybe_user = get_user_by( 'email', $invite->invitee_email ); // This user is already a member if ( $maybe_user ) { $message = sprintf( /* translators: %s: The log in link `<a href="login_url">log in</a>` */ esc_html__( 'Welcome! You are already a member of this site. Please %s to continue.', 'buddypress' ), sprintf( '<a href="%1$s">%2$s</a>', esc_url( wp_login_url( bp_get_root_domain() ) ), esc_html__( 'log in', 'buddypress' ) ) ); // This user can register! } else { // Fetch the display names of all inviters to personalize the welcome message. $args = array( 'invitee_email' => $invite->invitee_email, 'invite_sent' => 'sent', ); $all_invites = bp_members_invitations_get_invites( $args ); $inviters = array(); foreach ( $all_invites as $inv ) { $inviters[] = bp_core_get_user_displayname( $inv->inviter_id ); } if ( ! empty( $inviters ) ) { $message = sprintf( /* translators: %s: The comma separated list of inviters display names */ _n( 'Welcome! You’ve been invited to join the site by the following user: %s.', 'Welcome! You’ve been invited to join the site by the following users: %s.', count( $inviters ), 'buddypress' ), implode( ', ', $inviters ) ); } else { $message = __( 'Welcome! You’ve been invited to join the site. ', 'buddypress' ); } } return $message; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
8.0.0 | Introduced. |