- updated readme;
This commit is contained in:
Nikita Sinelnikov
2021-12-14 18:31:47 +02:00
parent 9c9ac59be7
commit 74bfdbcb18
6 changed files with 20 additions and 22 deletions
+1 -4
View File
@@ -457,10 +457,7 @@ if ( ! class_exists( 'um\core\Password' ) ) {
UM()->form()->add_error( 'username_b', __( 'Please provide your username or email', 'ultimate-member' ) );
}
if ( ( ! is_email( $user ) && ! username_exists( $user ) ) || ( is_email( $user ) && ! email_exists( $user ) ) ) {
UM()->form()->add_error( 'username_b', __( 'We can\'t find an account registered with that address or username', 'ultimate-member' ) );
} else {
if ( ( ! is_email( $user ) && username_exists( $user ) ) || ( is_email( $user ) && email_exists( $user ) ) ) {
if ( is_email( $user ) ) {
$user_id = email_exists( $user );
} else {
+1 -1
View File
@@ -144,7 +144,7 @@ function um_submit_account_errors_hook( $args ) {
}
if ( email_exists( $args['user_email'] ) && email_exists( $args['user_email'] ) !== get_current_user_id() ) {
UM()->form()->add_error( 'user_email', __( 'Email already linked to another account', 'ultimate-member' ) );
UM()->form()->add_error( 'user_email', __( 'Please provide a valid e-mail', 'ultimate-member' ) );
}
}
+11 -11
View File
@@ -775,7 +775,7 @@ function um_submit_form_errors_hook_( $args ) {
if ( $args[ $key ] == '' ) {
UM()->form()->add_error( $key, __( 'You must provide a username', 'ultimate-member' ) );
} elseif ( $mode == 'register' && username_exists( sanitize_user( $args[ $key ] ) ) ) {
UM()->form()->add_error( $key, __( 'Your username is already taken', 'ultimate-member' ) );
UM()->form()->add_error( $key, __( 'The username you entered is incorrect', 'ultimate-member' ) );
} elseif ( is_email( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'Username cannot be an email', 'ultimate-member' ) );
} elseif ( ! UM()->validation()->safe_username( $args[ $key ] ) ) {
@@ -787,11 +787,11 @@ function um_submit_form_errors_hook_( $args ) {
case 'unique_username_or_email':
if ( $args[ $key ] == '' ) {
UM()->form()->add_error( $key, __( 'You must provide a username', 'ultimate-member' ) );
UM()->form()->add_error( $key, __( 'You must provide a username or email', 'ultimate-member' ) );
} elseif ( $mode == 'register' && username_exists( sanitize_user( $args[ $key ] ) ) ) {
UM()->form()->add_error( $key, __( 'Your username is already taken', 'ultimate-member' ) );
UM()->form()->add_error( $key, __( 'The username you entered is incorrect', 'ultimate-member' ) );
} elseif ( $mode == 'register' && email_exists( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'This email is already linked to an existing account', 'ultimate-member' ) );
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
} elseif ( ! UM()->validation()->safe_username( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'Your username contains invalid characters', 'ultimate-member' ) );
}
@@ -813,11 +813,11 @@ function um_submit_form_errors_hook_( $args ) {
if ( $args[ $key ] == '' && in_array( $key, array( 'user_email' ) ) ) {
UM()->form()->add_error( $key, __( 'You must provide your email', 'ultimate-member' ) );
} elseif ( in_array( $mode, array( 'register' ) ) && $email_exists ) {
UM()->form()->add_error( $key, __( 'This email is already linked to an existing account', 'ultimate-member' ) );
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
} elseif ( in_array( $mode, array( 'profile' ) ) && $email_exists && $email_exists != $args['user_id'] ) {
UM()->form()->add_error( $key, __( 'This email is already linked to an existing account', 'ultimate-member' ) );
} elseif ( !is_email( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'This is not a valid email', 'ultimate-member') );
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
} elseif ( ! is_email( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member') );
} elseif ( ! UM()->validation()->safe_username( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'Your email contains invalid characters', 'ultimate-member' ) );
}
@@ -825,16 +825,16 @@ function um_submit_form_errors_hook_( $args ) {
} else {
if ( $args[ $key ] != '' && ! is_email( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'This is not a valid email', 'ultimate-member' ) );
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
} elseif ( $args[ $key ] != '' && email_exists( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'This email is already linked to an existing account', 'ultimate-member' ) );
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
} elseif ( $args[ $key ] != '' ) {
$users = get_users( 'meta_value=' . $args[ $key ] );
foreach ( $users as $user ) {
if ( $user->ID != $args['user_id'] ) {
UM()->form()->add_error( $key, __( 'This email is already linked to an existing account', 'ultimate-member' ) );
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
}
}
+2 -2
View File
@@ -65,12 +65,12 @@ function um_submit_form_errors_hook_login( $args ) {
$user = apply_filters( 'authenticate', null, $authenticate, $args['user_password'] );
if ( is_wp_error( $user ) && ! in_array( $user->get_error_code(), $ignore_codes ) ) {
UM()->form()->add_error( $user->get_error_code(), __( $user->get_error_message(), 'ultimate-member' ) );
UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
}
$user = apply_filters( 'wp_authenticate_user', $user, $args['user_password'] );
if ( is_wp_error( $user ) && ! in_array( $user->get_error_code(), $ignore_codes ) ) {
UM()->form()->add_error( $user->get_error_code(), __( $user->get_error_message(), 'ultimate-member' ) );
UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
}
// if there is an error notify wp