Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/29/2021 08:31:02 AM (6 years ago)
Author:
imath
Message:

Member Invites: add missing /* translators: */ inline comments

This commit also:

  • adds some tiny improvements to get along with WP Coding Standards,
  • removes a forgotten PHP notice using the right $args variable instead of the undefined $all_args one in bp_members_invitations_get_registration_welcome_message()
  • removes an extra <hr class="wp-header-end"> into the Manage Invitations Admin screen that was causing admin notices to appear twice.
  • Uses the wpautop() function instead of an inexisting wpautop filter into bp_members_invitations_add_legacy_welcome_message() and bp_members_invitations_add_legacy_registration_disabled_message().

Huge Props dcavins for this awesome new feature!

See #8139

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-filters.php

    r12923 r12930  
    209209                return $message;
    210210        }
     211
    211212        $invite = bp_get_members_invitation_from_request();
    212213        if ( ! $invite->id || ! $invite->invitee_email ) {
    … …  
    220221        if ( $maybe_user ) {
    221222                $message = sprintf(
    222                         esc_html__( 'Welcome! You are already a member of this site. Please %1$s to continue. ', 'buddypress' ),
    223                         sprintf( '<a href="%1$s">%2$s</a>', esc_url( wp_login_url( bp_get_root_domain() ) ), esc_html__( 'log in', 'buddypress' ) )
     223                        /* translators: %s: The log in link `<a href="login_url">log in</a>` */
     224                        esc_html__( 'Welcome! You are already a member of this site. Please %s to continue.', 'buddypress' ),
     225                        sprintf(
     226                                '<a href="%1$s">%2$s</a>',
     227                                esc_url( wp_login_url( bp_get_root_domain() ) ),
     228                                esc_html__( 'log in', 'buddypress' )
     229                        )
    224230                );
     231
    225232        // This user can register!
    226233        } else {
    … …  
    231238                        'invite_sent'   => 'sent',
    232239                );
    233                 $all_invites = bp_members_invitations_get_invites( $all_args );
    234                 $inviters = array();
     240
     241                $all_invites = bp_members_invitations_get_invites( $args );
     242                $inviters    = array();
     243
    235244                foreach ( $all_invites as $inv ) {
    236245                        $inviters[] = bp_core_get_user_displayname( $inv->inviter_id );
    … …  
    238247
    239248                if ( ! empty( $inviters ) ) {
    240                         $message = sprintf( _n( 'Welcome! You&#8217;ve been invited to join the site by the following user: %s. ', 'Welcome! You&#8217;ve been invited to join the site by the following users: %s. ', count( $inviters ), 'buddypress' ), implode( ', ', $inviters ) );
     249                        $message = sprintf(
     250                                /* translators: %s: The comma separated list of inviters display names */
     251                                _n( 'Welcome! You&#8217;ve been invited to join the site by the following user: %s.', 'Welcome! You&#8217;ve been invited to join the site by the following users: %s.', count( $inviters ), 'buddypress' ),
     252                                implode( ', ', $inviters )
     253                        );
    241254                } else {
    242255                        $message = __( 'Welcome! You&#8217;ve been invited to join the site. ', 'buddypress' );
    … …  
    270283
    271284                if ( ! $maybe_user ) {
    272                         $message = __( 'Member registration is allowed by invitation only.', 'buddypress' );
     285                        $message_parts = array( esc_html__( 'Member registration is allowed by invitation only.', 'buddypress' ) );
     286
    273287                        // Is the user trying to accept an invitation but something is wrong?
    274288                        if ( ! empty( $_GET['inv'] ) ) {
    275                                 $message .= __( ' It looks like there is a problem with your invitation. Please try again.', 'buddypress' );
     289                                $message_parts[] = esc_html__( 'It looks like there is a problem with your invitation. Please try again.', 'buddypress' );
    276290                        }
     291
     292                        $message = implode( ' ', $message_parts );
    277293                } else if ( 'nouveau' === bp_get_theme_package_id() ) {
    278294                        $message = sprintf(
     295                                /* translators: 1: The log in link `<a href="login_url">log in</a>`. 2: The lost password link `<a href="lost_password_url">log in</a>` */
    279296                                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' ),
    280                                 sprintf( '<a href="%1$s">%2$s</a>', esc_url( wp_login_url( bp_get_root_domain() ) ), esc_html__( 'log in', 'buddypress' ) ),
    281                                 sprintf( '<a href="%1$s">%2$s</a>', esc_url( wp_lostpassword_url(  bp_get_root_domain() ) ), esc_html__( 'reset it', 'buddypress' ) )
     297                                sprintf(
     298                                        '<a href="%1$s">%2$s</a>',
     299                                        esc_url( wp_login_url( bp_get_root_domain() ) ),
     300                                        esc_html__( 'log in', 'buddypress' )
     301                                ),
     302                                sprintf(
     303                                        '<a href="%1$s">%2$s</a>',
     304                                        esc_url( wp_lostpassword_url( bp_get_root_domain() ) ),
     305                                        esc_html__( 'reset it', 'buddypress' )
     306                                )
    282307                        );
    283308                }
    284309        }
     310
    285311        return $message;
    286312}
Note: See TracChangeset for help on using the changeset viewer.