Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#47522 closed enhancement (duplicate)

Make name fields in profile page swappable and modifiable by locales

Reported by: takahashi_fumiki's profile Takahashi_Fumiki Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.3
Component: I18N Keywords: has-patch
Focuses: ui, administration Cc:

Description

On the user profile page, the first name field precedes the last name field. In some locales, an order of name parts is different. For example, in some Asian locales(Chinese, Japanese, Korean, and Vietnamese), some part of Europe(Hungarian). And in some locales, name parts can be more than 2.

Examples

Below is the list of name patterns par locales. I'm not a linguist, so they may have incorrect information or a shortage.

e.g. English

Philip Roth
First Name Last Name

This style is very common in many locales and default of WordPress.

e.g. Japanese

Murakami Haruki
Family Name First Name

Family name(last name) comes first. CJKV, some part of Europe, and so on.

e.g. Russian:

Fyodor Mikhailovich Dostoevsky
First Name Patronym Last Name

Having multiple name parts. Some of the parts may be omitted with some reason.

Plans

  1. Change profile.php to adopt a filter hook for name fields.
  2. Name order is swappable with .po file like `wp_trim_words is. https://developer.wordpress.org/reference/functions/wp_trim_words/
  3. Options API is also modifiable for extra name parts.

Related tickets: #47511

Helpful resources: https://www.w3.org/International/questions/qa-personal-names

Attachments (3)

47522.patch (4.5 KB) - added by Takahashi_Fumiki 6 years ago.
Add new function wp_get_user_name_parts
47522.2.patch (4.4 KB) - added by Takahashi_Fumiki 6 years ago.
Fix function by removing debug code.
fixed-profile-page.png (42.2 KB) - added by Takahashi_Fumiki 6 years ago.
How it looks like if translated properly in Japanese.

Download all attachments as: .zip

Change History (8)

@Takahashi_Fumiki
6 years ago

Add new function wp_get_user_name_parts

@Takahashi_Fumiki
6 years ago

Fix function by removing debug code.

@Takahashi_Fumiki
6 years ago

How it looks like if translated properly in Japanese.

#1 @Takahashi_Fumiki
6 years ago

  • Keywords has-patch added; needs-patch removed

Added new function wp_get_user_name_parts() to get an assoc array like this.

<?php
[
  'first_name' => __( 'First Name' ),
  'last_name'  => __( 'Last Name' ),
]
  • This order can be controlled with _x( 'first_name,last_name' ) .
  • User edit function and admin screen are also relied on wp_get_user_name_parts().
  • Select box for display_name is not fixed yet.
  • Should consider how first_name and last_name are used in front part of the site(theme).

Any feedbacks are welcomed!

Last edited 6 years ago by Takahashi_Fumiki (previous) (diff)

#2 @ocean90
6 years ago

Related/Duplicate: #6148, #41931

#3 @johnbillion
6 years ago

I'd like to see the first and last name fields removed and replaced by a single field for the user's name.

@Takahashi_Fumiki Do you have any interest in contributing to #6148 instead?

#4 @Takahashi_Fumiki
6 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

@johnbillion Okay!
But I think this swap feature will be required for backward compatibility because there are lots of WP sites which already run with first_name and last_name.
I will send new patches to #6148.

#5 @desrosj
6 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.