I am using the
UserModel to create a user, and then injecting that into the User API service as is instructed in the documentation. The only thing I am not seeing is how to set the group.
I looked in the Model class and there is no method for setting the group and it's not part of the
In the documentation there is no method to set group, just read only the groups: https://craftcms.com/docs/templating/usermodel#getGroups
Nothing here about it: https://craftcms.com/classreference/services/UsersService
Here is what I am doing to save user.
$user = new UserModel; $user->username = 'username'; $user->email = 'email@example.com'; // $user->groupID = "group"; $user->firstName = 'first name'; $user->lastName = 'last name'; $user->getContent()->setAttributes([ 'usersAddress' => 'Your face' ]); craft()->users->saveUser($user);
Am I missing something obvious?