Answers.Body: <p>The <a href="http://buildwithcraft.com/docs/templating/usermodel#getGroups" rel="nofollow">UserModel</a> has a <a href="http://buildwithcraft.com/docs/templating/usermodel" rel="nofollow">getGroups()</a> function which:</p>
  
  <blockquote>
    <p>Returns an array of
    <a href="http://buildwithcraft.com/docs/templating/usergroupmodel" rel="nofollow">UserGroupModel</a>
    objects that the user belongs to.</p>
  </blockquote>
  
  <p>Since a user can belong to multiple usergroups, you have to loop through the array containing them:</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}
  
  # Loop through array of UserGroupModels #
  {% for group in thePartner.getGroups() %}
      # Print name of current UserGroupModel #
      {{ group.name }}
  {% endfor %}
  </code></pre>
  
  <p>If you are sure the user only belongs to one group, you can fetch the first UserGroupModel from like this:</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}
  
  # Get first UserGroupModel #
  {% set group = thePartner.getGroups().first %}
  
  # Print name #
  {{ group.name }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-02T18:24:04.493Z
Answers.Text: Perfect, thank you -- that did the trick nicely.
Answers.UserDisplayName: Shanan Galligan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-02T14:43:49.303Z
Answers.LastActivityDate: 2014-08-02T14:43:49.303Z
Answers.UserDisplayName: Victor
Body: <p>This seems simple, but I cannot get it to render -- how do display a user's User Group? Assuming I set the user in segment 2:</p>
  
  <pre><code>{% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}
  This Is My User Group: {% ???? %}
  </code></pre>
  
Tags: <templating><users>
Title: How do you display a user's User Group?
ThreadText: # How do you display a user's User Group?
  
  (Asked by: username_0 on 2014-08-02)
  
  This seems simple, but I cannot get it to render -- how do display a user's User Group? Assuming I set the user in segment 2:
  
  ```
  {% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}
  This Is My User Group: {% ???? %}
  
  ```
  
  **Tags:** templating, users
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-08-02. Score: 3 | Accepted answer
  
  The [UserModel](http://buildwithcraft.com/docs/templating/usermodel#getGroups) has a [getGroups()](http://buildwithcraft.com/docs/templating/usermodel) function which:
  
  > Returns an array of
  > [UserGroupModel](http://buildwithcraft.com/docs/templating/usergroupmodel)
  > objects that the user belongs to.
  
  Since a user can belong to multiple usergroups, you have to loop through the array containing them:
  
  ```twig
  {% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}
  
  # Loop through array of UserGroupModels #
  {% for group in thePartner.getGroups() %}
      # Print name of current UserGroupModel #
      {{ group.name }}
  {% endfor %}
  
  ```
  
  If you are sure the user only belongs to one group, you can fetch the first UserGroupModel from like this:
  
  ```twig
  {% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}
  
  # Get first UserGroupModel #
  {% set group = thePartner.getGroups().first %}
  
  # Print name #
  {{ group.name }}
  
  ```
  
  > **Comments:**
  > **username_0**: Perfect, thank you -- that did the trick nicely.  
  
  ---
  
  