I18N: Allow the login screen language to be specified via a wp_lang
query variable, and use this for the interim login modal.
This allows users who are using the admin area in a language other than the site language to read the notice on the login screen (which explains that they need to log in again) in their chosen language. Props Nikschavan, swissspidy Fixes #40205 git-svn-id: https://develop.svn.wordpress.org/trunk@41692 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b0c40f74d4
commit
1e16e5eee8
@ -5342,8 +5342,12 @@ function wp_auth_check_html() {
|
||||
<?php
|
||||
|
||||
if ( $same_domain ) {
|
||||
$login_src = add_query_arg( array(
|
||||
'interim-login' => '1',
|
||||
'wp_lang' => get_user_locale(),
|
||||
), $login_url );
|
||||
?>
|
||||
<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url( add_query_arg( array( 'interim-login' => 1 ), $login_url ) ); ?>"></div>
|
||||
<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url( $login_src ); ?>"></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
@ -425,12 +425,16 @@ setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure
|
||||
if ( SITECOOKIEPATH != COOKIEPATH )
|
||||
setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
|
||||
|
||||
$lang = ! empty( $_GET['wp_lang'] ) ? sanitize_text_field( $_GET['wp_lang'] ) : '';
|
||||
$switched_locale = switch_to_locale( $lang );
|
||||
|
||||
/**
|
||||
* Fires when the login form is initialized.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
do_action( 'login_init' );
|
||||
|
||||
/**
|
||||
* Fires before a specified login form action.
|
||||
*
|
||||
@ -484,6 +488,10 @@ case 'postpass' :
|
||||
}
|
||||
setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );
|
||||
|
||||
if ( $switched_locale ) {
|
||||
restore_previous_locale();
|
||||
}
|
||||
|
||||
wp_safe_redirect( wp_get_referer() );
|
||||
exit();
|
||||
|
||||
@ -501,6 +509,10 @@ case 'logout' :
|
||||
$requested_redirect_to = '';
|
||||
}
|
||||
|
||||
if ( $switched_locale ) {
|
||||
restore_previous_locale();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the log out redirect URL.
|
||||
*
|
||||
@ -589,6 +601,11 @@ endif;
|
||||
|
||||
<?php
|
||||
login_footer('user_login');
|
||||
|
||||
if ( $switched_locale ) {
|
||||
restore_previous_locale();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'resetpass' :
|
||||
@ -713,6 +730,11 @@ endif;
|
||||
|
||||
<?php
|
||||
login_footer('user_pass');
|
||||
|
||||
if ( $switched_locale ) {
|
||||
restore_previous_locale();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'register' :
|
||||
@ -788,6 +810,11 @@ case 'register' :
|
||||
|
||||
<?php
|
||||
login_footer('user_login');
|
||||
|
||||
if ( $switched_locale ) {
|
||||
restore_previous_locale();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'login' :
|
||||
@ -1031,5 +1058,10 @@ try {
|
||||
|
||||
<?php
|
||||
login_footer();
|
||||
|
||||
if ( $switched_locale ) {
|
||||
restore_previous_locale();
|
||||
}
|
||||
|
||||
break;
|
||||
} // end action switch
|
||||
|
Loading…
Reference in New Issue
Block a user