Coding Standards: Move assignments out of conditions in wp-includes/user.php.

Props subrataemfluence.
See #44315.



git-svn-id: https://develop.svn.wordpress.org/trunk@44597 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2019-01-15 05:37:48 +00:00
parent 65d6dd18b9
commit da17f41cc1

View File

@ -1400,7 +1400,8 @@ function clean_user_cache( $user ) {
* @return int|false The user's ID on success, and false on failure. * @return int|false The user's ID on success, and false on failure.
*/ */
function username_exists( $username ) { function username_exists( $username ) {
if ( $user = get_user_by( 'login', $username ) ) { $user = get_user_by( 'login', $username );
if ( $user ) {
$user_id = $user->ID; $user_id = $user->ID;
} else { } else {
$user_id = false; $user_id = false;
@ -1430,7 +1431,8 @@ function username_exists( $username ) {
* @return int|false The user's ID on success, and false on failure. * @return int|false The user's ID on success, and false on failure.
*/ */
function email_exists( $email ) { function email_exists( $email ) {
if ( $user = get_user_by( 'email', $email ) ) { $user = get_user_by( 'email', $email );
if ( $user ) {
return $user->ID; return $user->ID;
} }
return false; return false;
@ -2823,10 +2825,14 @@ All at ###SITENAME###
*/ */
function new_user_email_admin_notice() { function new_user_email_admin_notice() {
global $pagenow; global $pagenow;
if ( 'profile.php' === $pagenow && isset( $_GET['updated'] ) && $email = get_user_meta( get_current_user_id(), '_new_email', true ) ) {
if ( 'profile.php' === $pagenow && isset( $_GET['updated'] ) ) {
$email = get_user_meta( get_current_user_id(), '_new_email', true );
if ( $email ) {
/* translators: %s: New email address */ /* translators: %s: New email address */
echo '<div class="notice notice-info"><p>' . sprintf( __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ), '<code>' . esc_html( $email['newemail'] ) . '</code>' ) . '</p></div>'; echo '<div class="notice notice-info"><p>' . sprintf( __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ), '<code>' . esc_html( $email['newemail'] ) . '</code>' ) . '</p></div>';
} }
}
} }
/** /**