On the user register form that you're working on, as well as logging the user in I also need to add some validation to make sure the user includes their first and last name.. The email seems to be required by default...
Also I need to add validation to the password so that it is at least 8 characters long and uses both letters and numbers...is this possible?
but how would I add a validation for the password to be at least 8 characters long and a mix of letters and numbers..
==>
I was working on that issue only 🙂
I've adjusted the code as given under so it will display different errors - the password will only allow letters and numbers and password must be greater than 8 characters.
add_filter( 'cred_form_validate', 'func_check_password_len_with_numchar', 10, 2 );
function func_check_password_len_with_numchar( $error_fields, $form_data ) {
$forms = array( 1562);
list($fields,$errors)=$error_fields;
if( in_array( $form_data['id'], $forms ) ){
$pass = isset($_POST['user_pass']) ? $_POST['user_pass'] : '';
if( strlen($pass) < 8 ){
$errors['user_pass'] = __('Password must include a minimum of 8 characters');
}else if(!ctype_alnum($pass)){
$errors['user_pass'] = __('Password must include letters and numbers');
}
}
return array( $fields, $errors );
}
It still lets me create an account with the password 'abcdefgh' - This is incorrect as it is does not include numbers..I need the password to use BOTH numbers and letters..
Also Minesh my original ticket re the logging in after sign up seems to have gone cold...are you still working on this...just checking not pestering..I know you're busy!..