I18N: Use a translatable string for displaying a user's first name and last name.
That allows locales to switch the order of the first name and last name, should they prefer to do so. The string was previously used in `wp_insert_user()` and is now reused in other places for consistency: * `WP_MS_Users_List_Table::column_name()` * `WP_Users_List_Table::column_name()` * `wp_list_authors()` * `wp_list_users()` Note: This also removes the `wp_list_author_full_name` filter, introduced for the same purpose in `wp_list_authors()`, as redundant for now. Follow-up to [53486]. See #17025. Built from https://develop.svn.wordpress.org/trunk@53501 git-svn-id: http://core.svn.wordpress.org/trunk@53090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cc05e7b608
commit
3f74637dfe
|
@ -302,7 +302,12 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
|||
*/
|
||||
public function column_name( $user ) {
|
||||
if ( $user->first_name && $user->last_name ) {
|
||||
echo "$user->first_name $user->last_name";
|
||||
printf(
|
||||
/* translators: 1: User's first name, 2: Last name. */
|
||||
_x( '%1$s %2$s', 'Display name based on first name and last name' ),
|
||||
$user->first_name,
|
||||
$user->last_name
|
||||
);
|
||||
} elseif ( $user->first_name ) {
|
||||
echo $user->first_name;
|
||||
} elseif ( $user->last_name ) {
|
||||
|
|
|
@ -568,7 +568,12 @@ class WP_Users_List_Table extends WP_List_Table {
|
|||
break;
|
||||
case 'name':
|
||||
if ( $user_object->first_name && $user_object->last_name ) {
|
||||
$r .= "$user_object->first_name $user_object->last_name";
|
||||
$r .= sprintf(
|
||||
/* translators: 1: User's first name, 2: Last name. */
|
||||
_x( '%1$s %2$s', 'Display name based on first name and last name' ),
|
||||
$user_object->first_name,
|
||||
$user_object->last_name
|
||||
);
|
||||
} elseif ( $user_object->first_name ) {
|
||||
$r .= $user_object->first_name;
|
||||
} elseif ( $user_object->last_name ) {
|
||||
|
|
|
@ -476,20 +476,12 @@ function wp_list_authors( $args = '' ) {
|
|||
}
|
||||
|
||||
if ( $args['show_fullname'] && $author->first_name && $author->last_name ) {
|
||||
|
||||
$full_name = $author->first_name . ' ' . $author->last_name;
|
||||
|
||||
/**
|
||||
* Filters the author's full name.
|
||||
*
|
||||
* @since 6.1.0
|
||||
*
|
||||
* @param string $full_name Full Name of the author. Default: The author's first name
|
||||
* and last name, separated by a space.
|
||||
* @param object $author Author object.
|
||||
*/
|
||||
$name = apply_filters( 'wp_list_author_full_name', $full_name, $author );
|
||||
|
||||
$name = sprintf(
|
||||
/* translators: 1: User's first name, 2: Last name. */
|
||||
_x( '%1$s %2$s', 'Display name based on first name and last name' ),
|
||||
$author->first_name,
|
||||
$author->last_name
|
||||
);
|
||||
} else {
|
||||
$name = $author->display_name;
|
||||
}
|
||||
|
|
|
@ -827,7 +827,12 @@ function wp_list_users( $args = array() ) {
|
|||
}
|
||||
|
||||
if ( $args['show_fullname'] && '' !== $user->first_name && '' !== $user->last_name ) {
|
||||
$name = "$user->first_name $user->last_name";
|
||||
$name = sprintf(
|
||||
/* translators: 1: User's first name, 2: Last name. */
|
||||
_x( '%1$s %2$s', 'Display name based on first name and last name' ),
|
||||
$user->first_name,
|
||||
$user->last_name
|
||||
);
|
||||
} else {
|
||||
$name = $user->display_name;
|
||||
}
|
||||
|
@ -2242,8 +2247,12 @@ function wp_insert_user( $userdata ) {
|
|||
if ( $update ) {
|
||||
$display_name = $user_login;
|
||||
} elseif ( $meta['first_name'] && $meta['last_name'] ) {
|
||||
/* translators: 1: User's first name, 2: Last name. */
|
||||
$display_name = sprintf( _x( '%1$s %2$s', 'Display name based on first name and last name' ), $meta['first_name'], $meta['last_name'] );
|
||||
$display_name = sprintf(
|
||||
/* translators: 1: User's first name, 2: Last name. */
|
||||
_x( '%1$s %2$s', 'Display name based on first name and last name' ),
|
||||
$meta['first_name'],
|
||||
$meta['last_name']
|
||||
);
|
||||
} elseif ( $meta['first_name'] ) {
|
||||
$display_name = $meta['first_name'];
|
||||
} elseif ( $meta['last_name'] ) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-alpha-53500';
|
||||
$wp_version = '6.1-alpha-53501';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue