From 04a91857dd90a363a92db8aafdf521fdf12220a4 Mon Sep 17 00:00:00 2001 From: Champ Camba Date: Tue, 14 Mar 2017 19:01:12 +0800 Subject: [PATCH] Fix wp authenticate hook filter --- core/um-actions-login.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/um-actions-login.php b/core/um-actions-login.php index 0ad429a9..45d1570f 100644 --- a/core/um-actions-login.php +++ b/core/um-actions-login.php @@ -66,10 +66,15 @@ // add a way for other plugins like wp limit login // to limit the login attempts - $user = apply_filters( 'authenticate', $user, $user_name, $args['user_password'] ); + $user = apply_filters( 'authenticate', null, $user_name, $args['user_password'] ); + + if ( $user == null ) { + + $ultimatemember->form->add_error( $field, __( 'ERROR: Invalid username, email address or incorrect password.','ultimatemember' ) ); + } // if there is an error notify wp - if( $ultimatemember->form->has_error( $field ) || $ultimatemember->form->has_error( $user_password ) ) { + if( $ultimatemember->form->has_error( $field ) || $ultimatemember->form->has_error( $user_password ) || is_wp_error( $user ) ) { do_action( 'wp_login_failed', $user_name ); } } @@ -270,7 +275,7 @@ if ( $args['forgot_pass_link'] == 0 ) return; - ?> + ?>