Site icon Hip-Hop Website Design and Development

Add new password rule to Final Member register kind

I take advantage of Final Member and traditional kind for registration.

I’ve enabled "Strong password", however I would like my customers to no less than fill their password with 1 particular character (like "# % $ …")

I did not discover any plugin, so I attempted to seek out the nice hook and I attempted this code :

operate um_submit_form_register_theme($args) {
    international $ultimatemember;
    $password = $_POST['user_password-257'];
    
    if ( !isset($ultimatemember->form->errors) ) {
        if (!preg_match("/W/", $password)) {
            $ultimatemember->lessons['form']->add_error( 'user_password-257', __('Your password should a particular caractere') );
        } else {
            do_action('um_user_registration', $args); 
        }
    }
 
    do_action('um_user_registration_extra_hook', $args ); 
}
add_action('um_submit_form_register', 'um_submit_form_register_theme', 10);

But it surely does not work… The registration with no particular character. Any clue ?