Answers.Body: <p><code>assignUserToGroups</code> has <code>$groupIds</code> parameter (int / array) preset to <code>null</code>. From <a href="http://buildwithcraft.com/classreference/services/UserGroupsService#assignUserToGroups-detail" rel="nofollow">the docs</a>:</p>
  
  <blockquote>
    <p><code>assignUserToGroups($userId, $groupIds = null)</code></p>
  </blockquote>
  
  <p>So calling the function without that parameter set should do it:</p>
  
  <pre><code>craft()-&gt;userGroups-&gt;assignUserToGroups(1);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-18T11:30:15.043Z
Answers.Text: Ok thanks that does the job. Do you know if there is a way to remove the user from a specific group? Just forward thinking here. Cheers
Answers.UserDisplayName: Lettie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-18T11:32:38.993Z
Answers.Text: Get all group IDs the user is assigned to and remove one group ID from that array, before passing it to `assignUserToGroups`.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-18T11:35:49.950Z
Answers.Text: That'll work cheers
Answers.UserDisplayName: Lettie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-18T11:22:32.193Z
Answers.LastActivityDate: 2015-05-18T11:22:32.193Z
Answers.UserDisplayName: carlcs
Body: <p>Ok this should be pretty simple I feel! But I can't find the documentation for it.</p>
  
  <p>I can set assign a user to a user group within a plugin with:</p>
  
  <pre><code>craft()-&gt;userGroups-&gt;assignUserToGroups($userid, $groupid);
  </code></pre>
  
  <p>How do I do the reverse and remove a user from a user group?</p>
  
  <p>Cheers.</p>
  
Tags: <users><user-groups>
Title: How to remove a user from a user group?
ThreadText: # How to remove a user from a user group?
  
  (Asked by: username_0 on 2015-05-18)
  
  Ok this should be pretty simple I feel! But I can't find the documentation for it.
  
  I can set assign a user to a user group within a plugin with:
  
  ```
  craft()->userGroups->assignUserToGroups($userid, $groupid);
  
  ```
  
  How do I do the reverse and remove a user from a user group?
  
  Cheers.
  
  **Tags:** users, user-groups
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-05-18. Score: 4 | Accepted answer
  
  `assignUserToGroups` has `$groupIds` parameter (int / array) preset to `null`. From [the docs](http://buildwithcraft.com/classreference/services/UserGroupsService#assignUserToGroups-detail):
  
  > `assignUserToGroups($userId, $groupIds = null)`
  
  So calling the function without that parameter set should do it:
  
  ```
  craft()->userGroups->assignUserToGroups(1);
  
  ```
  
  > **Comments:**
  > **username_0**: Ok thanks that does the job. Do you know if there is a way to remove the user from a specific group? Just forward thinking here. Cheers  
  > **username_1**: Get all group IDs the user is assigned to and remove one group ID from that array, before passing it to `assignUserToGroups`.  
  > **username_0**: That'll work cheers  
  
  ---
  
  