I use the following script-part to modify my pw:
if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {
if ( $_POST['pass1'] == $_POST['pass2'] )
wp_update_user( array( 'ID' => $current_user->ID, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );
else
$error[] = __('Password doesn't match.', 'profile');
}
... and I try to add characters type and pw length:
if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {
if ( $_POST['pass1'] == $_POST['pass2'] && !preg_match('/^[a-zA-Z0-9]+$/', $_POST['pass1'], $_POST['pass2']) || strlen($_POST['pass1'], $_POST['pass2']) < 8)
wp_update_user( array( 'ID' => $current_user->ID, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );
else
$error[] = __('Password doesn't match.', 'profile');
}
... but it fails. Whats wrong (Sorry, I am not a php pro)?