From 1b0da5641122c503d79e98d4788d3d499c67829a Mon Sep 17 00:00:00 2001 From: champsupertramp Date: Fri, 13 May 2016 19:22:15 +0800 Subject: [PATCH] Add new action 'wp_authenticate_username_password_before' --- core/um-actions-login.php | 10 ++++++++++ core/um-filters-login.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/um-actions-login.php b/core/um-actions-login.php index 2c300356..0a694b36 100644 --- a/core/um-actions-login.php +++ b/core/um-actions-login.php @@ -286,3 +286,13 @@ echo $ultimatemember->fields->display( 'login', $args ); } + + /** + * Remove authenticate filter + * @uses 'wp_authenticate_username_password_before' + */ + add_action('wp_authenticate_username_password_before','um_auth_username_password_before',10,3); + function um_auth_username_password_before( $user, $username, $password ){ + remove_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 ); + } + diff --git a/core/um-filters-login.php b/core/um-filters-login.php index ec46ff06..f183efd7 100644 --- a/core/um-filters-login.php +++ b/core/um-filters-login.php @@ -66,7 +66,7 @@ add_filter('authenticate', 'um_wp_form_errors_hook_logincheck', 999, 3); function um_wp_form_errors_hook_logincheck( $user, $username, $password ) { - remove_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 ); + do_action('wp_authenticate_username_password_before', $user, $username, $password ); if ( isset( $user->ID ) ) {