User registrations are working great, except that the password that he chose isn't being accepted when the user tries to sign in, generating a new password from the back-end and trying to login with the generated password works. what am i missing here?
$email = $_POST["email"];
$password = $_POST["password1"];
$firstName = $_POST["fname"];
$lastName = $_POST["lname"];
$company = $_POST["company"];
$website = $_POST["website"];
$address = $_POST["address"];
$street = $_POST["street"];
$city = $_POST["city"];
$state = $_POST["state"];
$zip = $_POST["zip"];
$country = $_POST["country"];
$home = $_POST["home"];
$office = $_POST["office"];
$mobile = $_POST["mobile"];
if( null == username_exists( $email ) ) {
$user_id = wp_create_user( $email, $password, $email );
wp_update_user(
array(
'ID' => $user_id,
'nickname' => $email_address,
'first_name' => $firstName,
'last_name' => $lastName,
'user_url' => $website
)
);
update_user_meta( $user_id, 'company', $company );
update_user_meta( $user_id, 'address', $address );
update_user_meta( $user_id, 'street', $street );
update_user_meta( $user_id, 'city', $city );
update_user_meta( $user_id, 'province', $state );
update_user_meta( $user_id, 'postalcode', $zip);
update_user_meta( $user_id, 'country', $country );
update_user_meta( $user_id, 'home', $home );
update_user_meta( $user_id, 'office', $office );
update_user_meta( $user_id, 'mobile', $mobile );
$user = new WP_User( $user_id );
$user->set_role( 'subscriber' );
} else {
echo 'user exists';
}
replacing $password
in wp_create_user()
with 'testpassword'
or adding a new line to the wp_update_user()
array 'user_pass' => 'testpassword'
both didn't work.