Problem: I would like to enforce a minimum length for User passwords in Forms.
Solution: You can use the cred_form_validate API to apply back-end validation to password fields.
// require minimum password length in User Forms add_filter( 'cred_form_validate', 'validate_password_length', 10, 2 ); function validate_password_length( $error_fields, $form_data ) { $forms = array( 1234, 5678 ); list($fields,$errors)=$error_fields; if( in_array( $form_data['id'], $forms ) ){ $p = isset($fields['user_pass']['value']) ? $fields['user_pass']['value'] : ''; if( strlen($p) < 6 ){ $errors['user_pass'] = __('Password must include a minimum of 6 characters'); } } return array( $fields, $errors ); }
Relevant Documentation: https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Our next available supporter will start replying to tickets in about 2.36 hours from now. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 2 replies, has 2 voices.
Last updated by 6 years, 3 months ago.
Assisted by: Christian Cox.