mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-02 03:34:33 +00:00
I18N: Add ability to change user's locale back to site's locale.
Previously there was no way to remove the user locale setting again, even though that might be desirable. This adds a new 'Site Default' option to the user-specific language setting by introducing a new `show_site_locale_default` argument to `wp_dropdown_languages()`. Props ocean90. See #29783. Fixes #38632. git-svn-id: https://develop.svn.wordpress.org/trunk@39169 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -98,11 +98,13 @@ function edit_user( $user_id = 0 ) {
|
||||
|
||||
if ( isset( $_POST['locale'] ) ) {
|
||||
$locale = sanitize_text_field( $_POST['locale'] );
|
||||
if ( ! in_array( $locale, get_available_languages(), true ) ) {
|
||||
if ( 'site-default' === $locale ) {
|
||||
$locale = '';
|
||||
} elseif ( ! in_array( $locale, get_available_languages(), true ) ) {
|
||||
$locale = 'en_US';
|
||||
}
|
||||
|
||||
$user->locale = ( '' === $locale ) ? 'en_US' : $locale;
|
||||
$user->locale = $locale;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user