message; } /** * Provide a more-specific "registration is disabled" message * if registration is available by invitation only. * Also provide failure note if new user is trying to accept * a network invitation but there's a problem. * * @since 8.0.0 * * @return string $message The message text. */ function bp_members_invitations_get_modified_registration_disabled_message() { $message = ''; if ( bp_get_members_invitations_allowed() ) { $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 ); if ( ! $maybe_user ) { $message_parts = array( esc_html__( 'Member registration is allowed by invitation only.', 'buddypress' ) ); // Is the user trying to accept an invitation but something is wrong? if ( ! empty( $_GET['inv'] ) ) { $message_parts[] = esc_html__( 'It looks like there is a problem with your invitation. Please try again.', 'buddypress' ); } $message = implode( ' ', $message_parts ); } else if ( 'nouveau' === bp_get_theme_package_id() ) { $message = sprintf( /* translators: 1: The log in link `log in`. 2: The lost password link `log in` */ esc_html__( 'Welcome! You are already a member of this site. Please %1$s to continue. If you have forgotten your password, you can %2$s.', 'buddypress' ), sprintf( '%2$s', esc_url( wp_login_url( bp_get_root_url() ) ), esc_html__( 'log in', 'buddypress' ) ), sprintf( '%2$s', esc_url( wp_lostpassword_url( bp_get_root_url() ) ), esc_html__( 'reset it', 'buddypress' ) ) ); } } return $message; } /** * Sanitize the invitation property output. * * @since 8.0.0 * * @param int|string $value The value for the requested property. * @param string $property The name of the requested property. * @param string $context Optional. The context of display. * @return int|string The sanitized value. */ function bp_members_sanitize_invitation_property( $value = '', $property = '', $context = 'html' ) { if ( ! $property ) { return ''; } switch ( $property ) { case 'id': case 'user_id': case 'item_id': case 'secondary_item_id': $value = absint( $value ); break; case 'invite_sent': case 'accepted': $value = absint( $value ) ? __( 'Yes', 'buddypress' ) : __( 'No', 'buddypress' ); $value = 'attribute' === $context ? esc_attr( $value ) : esc_html( $value ); break; case 'invitee_email': $value = sanitize_email( $value ); break; case 'content': $value = wp_kses( $value, array() ); $value = wptexturize( $value ); break; case 'date_modified': $value = mysql2date( 'Y/m/d g:i:s a', $value ); $value = 'attribute' === $context ? esc_attr( $value ) : esc_html( $value ); break; default: $value = 'attribute' === $context ? esc_attr( $value ) : esc_html( $value ); break; } return $value; } add_filter( 'bp_the_members_invitation_property', 'bp_members_sanitize_invitation_property', 10, 3 );