Add new password rule to Ultimate Member register form
Question
I use Ultimate Member and classic form for registration.
I have enabled “Strong password”, but I want my users to at least fill their password with 1 special character (like “# % $ …”)
I didn’t find any plugin, so I tried to find the good hook and I tried this code :
function um_submit_form_register_theme($args) {
global $ultimatemember;
$password = $_POST['user_password-257'];
if ( !isset($ultimatemember->form->errors) ) {
if (!preg_match("/W/", $password)) {
$ultimatemember->classes['form']->add_error( 'user_password-257', __('Your password must a special 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 doesn’t work… The registration with no special character. Any clue ?
0
members, password, plugins
2 years
2020-09-04T05:10:29-05:00
2020-09-04T05:10:29-05:00 0 Answers
92 views
0
Leave an answer