Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $user = User::create();
- $userEmail = $form_state->getValue('user_email');
- // Generate Password
- $password = user_password();
- // Save User
- $user->setPassword($password);
- $user->enforceIsNew();
- $user->setEmail($userEmail);
- $user->setUsername($userEmail);
- $user->set("field_firstname", $form_state->getValue('user_firstname'));
- $user->set("field_lastname", $form_state->getValue('user_lastname'));
- $user->set("field_company", $pub_company . ' ' . $newCompanyNode->id());
- $user->activate();
- $user->save();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement