I18N: Add language switcher on login/registration screens.
Load a language switcher on the login and registration screens that allows users to choose any already-installed language. Set user locale on registration. Props johnbillion, Nikschavan, afercia, sabernhardt, garrett-eclipse, keyur5, paaljoachim, Clorith, tobifjellner. Fixes #43700. Built from https://develop.svn.wordpress.org/trunk@52058 git-svn-id: http://core.svn.wordpress.org/trunk@51650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -3044,6 +3044,13 @@ function register_new_user( $user_login, $user_email ) {
|
||||
|
||||
update_user_meta( $user_id, 'default_password_nag', true ); // Set up the password change nag.
|
||||
|
||||
if ( ! empty( $_COOKIE['wp_lang'] ) ) {
|
||||
$wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] );
|
||||
if ( in_array( $wp_lang, get_available_languages(), true ) ) {
|
||||
update_user_meta( $user_id, 'locale', $wp_lang ); // Set user locale if defined on registration.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after a new user registration has been recorded.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user