How to let user set password on registration

Its Not has hard as you think it is 🙂

Add the password fields to your form :

password: <input type="password" name="pass1" style="width:250px; margin-bottom:3px;"><br />
repeat password: <input type="password" name="pass2" style="width:250px; margin-bottom:3px;"><br />

then in your if($_POST){ replace this line:

$random_password = wp_generate_password( 12, false );

with this:

$pass1 = $wpdb->escape($_REQUEST['pass1']);
$pass2 = $wpdb->escape($_REQUEST['pass2']);
if ($pass1 != $pass2){
    echo "<span style="color:#FF0000"><strong>Error..</strong></span><br /><br />please use a passwords don't match.";
        exit();

}
$random_password = $pass1;

Leave a Comment