diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 4411880768..f99c50d85c 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -112,25 +112,25 @@ function edit_user( $user_id = 0 ) { } } + if ( isset( $_POST['locale'] ) ) { + $locale = sanitize_text_field( $_POST['locale'] ); + if ( 'site-default' === $locale ) { + $locale = ''; + } elseif ( '' === $locale ) { + $locale = 'en_US'; + } elseif ( ! in_array( $locale, get_available_languages(), true ) ) { + $locale = ''; + } + + $user->locale = $locale; + } + if ( $update ) { $user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' === $_POST['rich_editing'] ? 'false' : 'true'; $user->syntax_highlighting = isset( $_POST['syntax_highlighting'] ) && 'false' === $_POST['syntax_highlighting'] ? 'false' : 'true'; $user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh'; $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false'; $user->locale = ''; - - if ( isset( $_POST['locale'] ) ) { - $locale = sanitize_text_field( $_POST['locale'] ); - if ( 'site-default' === $locale ) { - $locale = ''; - } elseif ( '' === $locale ) { - $locale = 'en_US'; - } elseif ( ! in_array( $locale, get_available_languages(), true ) ) { - $locale = ''; - } - - $user->locale = $locale; - } } $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; diff --git a/wp-admin/user-new.php b/wp-admin/user-new.php index be4b5083bc..9e36e2a6e0 100644 --- a/wp-admin/user-new.php +++ b/wp-admin/user-new.php @@ -498,6 +498,32 @@ if ( current_user_can( 'create_users' ) ) { + + + + + + + 'locale', + 'id' => 'locale', + 'selected' => 'site-default', + 'languages' => $languages, + 'show_available_translations' => false, + 'show_option_site_default' => true, + ) ); + ?> + + +