Assigning Groups
Assigning a user to one or more groups is as simple as passing an array of group_ids to that user when adding or updating.
When Adding a User
When adding a user, you can pass an array of group_ids for that user to be added to. If you don't, the user will be added to whatever you have specified in the configuration file as default_group_id.
$user = array(
'username' => 'testuser',
'password' => 'ABC123!',
'groups' => array(2,5,7)
);
$this->bitauth->add_user($user);
When Updating a User
When updating a user, the same applies. What groups the user is a member of are passed as an array to update_user().
$user = $this->bitauth->get_user_by_username('testuser');
$user->groups = array(2,5,7);
$this->bitauth->update_user($user->user_id, $user);