I am building a component which has its own registration form. Most of its properties work well but I couldn't set the usertype or usergroup of the user in J1.6 or J2.5. I am not fully knowledgeable about platforms, I am trying something first for me. Here is mye piece of code in model class
// Prepare the data for the user object. Data comes from controller
$data['name'] = $data['companyName'];
$data['username'] = MyCompHelper::getCreatedUserName($data['type']);//for system created username based on the type from form
$data['email'] = $data['email1'];
$data['password'] = (!empty($data['password1'])) ? $data['password1'] : '';
$data['usertype'] = $params->get('new_usertype',2);
Then I bind the data to user object and save it but user isn't assigned to any group. So I think I should correct this
$data['usertype'] = $params->get('new_usertype',2);
part but which way, what I write instead