Validations on WP native fields in a CRED User form

Problem:
Validation and Required field option should work at once in CRED User form for native WP Fields (e.g. Last Name), same as builtin CRED validation style.

Solution:
1. Add this code in your theme’s or child theme’s functions.php file:

add_filter('cred_filter_field_before_add_to_form', 'required_fields_func', 10, 2);
function required_fields_func($field, $computed_values){
    if(in_array($field['id'], array('last_name', 'adresse'))){
        $field['data']['validate']['required'] = array ( 
            'active' => 1, 
            'value' => 1, 
            'message' => 'This field is required.'
        ) ;
    }
    return $field;
}

— Make sure to replace ‘last_name’, ‘adresse’ with your field slugs on line #3
— You can modify the message text as needed in above code on line #7.

2. OR If you want to have JS validation, you can use this (modification will be needed):
https://wp-types.com/forums/topic/cred-user-field-not-required/#post-567100

Related Ticket:
https://wp-types.com/forums/topic/cred-user-field-not-required/