From 1f7eb3e5954e919ad648130b4bf7a682092c1d26 Mon Sep 17 00:00:00 2001 From: Gregory Karpinsky Date: Thu, 6 Nov 2014 23:08:48 -0500 Subject: [PATCH] Update class-wc-shortcode-my-account.php Return if no data submitted. Otherwise, two PHP notices are issued on checking `! $user_data` and two `wc_add_notice` printed. --- includes/shortcodes/class-wc-shortcode-my-account.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/shortcodes/class-wc-shortcode-my-account.php b/includes/shortcodes/class-wc-shortcode-my-account.php index a05b7a0b3ca..b49b29aed0c 100644 --- a/includes/shortcodes/class-wc-shortcode-my-account.php +++ b/includes/shortcodes/class-wc-shortcode-my-account.php @@ -224,6 +224,7 @@ class WC_Shortcode_My_Account { if ( empty( $_POST['user_login'] ) ) { wc_add_notice( __( 'Enter a username or e-mail address.', 'woocommerce' ), 'error' ); + return false; } else { // Check on username first, as customers can use emails as usernames. @@ -231,7 +232,7 @@ class WC_Shortcode_My_Account { $user_data = get_user_by( 'login', $login ); } - // If no user found, check if it login is emaill and lookup user based on email. + // If no user found, check if it login is email and lookup user based on email. if ( ! $user_data && is_email( $_POST['user_login'] ) && apply_filters( 'woocommerce_get_username_from_email', true ) ) { $user_data = get_user_by( 'email', trim( $_POST['user_login'] ) ); }