mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed #840;
This commit is contained in:
@@ -292,6 +292,21 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the errors as a WordPress Error object
|
||||
* @return WP_Error
|
||||
*/
|
||||
function get_wp_error() {
|
||||
$wp_error = new \WP_Error();
|
||||
if ( $this->count_errors() > 0 ) {
|
||||
foreach ( $this->errors as $key => $value ) {
|
||||
$wp_error->add( $key, $value );
|
||||
}
|
||||
}
|
||||
return $wp_error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Declare all fields
|
||||
*/
|
||||
|
||||
@@ -75,7 +75,7 @@ function um_submit_form_errors_hook_login( $args ) {
|
||||
|
||||
// if there is an error notify wp
|
||||
if ( UM()->form()->has_error( $field ) || UM()->form()->has_error( $user_password ) || UM()->form()->count_errors() > 0 ) {
|
||||
do_action( 'wp_login_failed', $user_name, UM()->form()->errors );
|
||||
do_action( 'wp_login_failed', $user_name, UM()->form()->get_wp_error() );
|
||||
}
|
||||
}
|
||||
add_action( 'um_submit_form_errors_hook_login', 'um_submit_form_errors_hook_login', 10 );
|
||||
|
||||
Reference in New Issue
Block a user