From ce1832f49c16adf883acbaae707b4daac881ba40 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Sun, 20 Sep 2015 09:10:59 +0000 Subject: [PATCH] Login: Move the "Lost your password?" link into a separate string to reduce HTML tags in translation strings. Props ramiy. Fixes #31870. git-svn-id: https://develop.svn.wordpress.org/trunk@34354 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/user-functions.php | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/wp-includes/user-functions.php b/src/wp-includes/user-functions.php index 856ca673c8..701e38cf34 100644 --- a/src/wp-includes/user-functions.php +++ b/src/wp-includes/user-functions.php @@ -136,8 +136,14 @@ function wp_authenticate_username_password($user, $username, $password) { $user = get_user_by('login', $username); - if ( !$user ) - return new WP_Error( 'invalid_username', sprintf( __( 'ERROR: Invalid username. Lost your password?' ), wp_lostpassword_url() ) ); + if ( !$user ) { + return new WP_Error( 'invalid_username', + __( 'ERROR: Invalid username.' ) . + ' ' . + __( 'Lost your password?' ) . + '' + ); + } /** * Filter whether the given user can be authenticated with the provided $password. @@ -152,9 +158,18 @@ function wp_authenticate_username_password($user, $username, $password) { if ( is_wp_error($user) ) return $user; - if ( !wp_check_password($password, $user->user_pass, $user->ID) ) - return new WP_Error( 'incorrect_password', sprintf( __( 'ERROR: The password you entered for the username %1$s is incorrect. Lost your password?' ), - $username, wp_lostpassword_url() ) ); + if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) { + return new WP_Error( 'incorrect_password', + sprintf( + /* translators: %s: user name */ + __( 'ERROR: The password you entered for the username %s is incorrect.' ), + '' . $username . '' + ) . + ' ' . + __( 'Lost your password?' ) . + '' + ); + } return $user; }