Users: In edit_user() fall back to site's locale instead of en_US for invalid user locales.

See #38632, #29783.
Fixes #38798.

git-svn-id: https://develop.svn.wordpress.org/trunk@39269 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2016-11-16 20:11:12 +00:00
parent be9b516d42
commit a9a8a9b121

View File

@ -100,8 +100,10 @@ function edit_user( $user_id = 0 ) {
$locale = sanitize_text_field( $_POST['locale'] );
if ( 'site-default' === $locale ) {
$locale = '';
} elseif ( ! in_array( $locale, get_available_languages(), true ) ) {
} elseif ( '' === $locale ) {
$locale = 'en_US';
} elseif ( ! in_array( $locale, get_available_languages(), true ) ) {
$locale = '';
}
$user->locale = $locale;