Answers.Body: <p>If I'm following you, you've got restaurants set up as user accounts in Craft and you've got a category field assigned to the Users field layout and you're trying to access those categories.</p>
  
  <p>If so, it's as simple as it is in the docs: <a href="https://craftcms.com/docs/categories-fields#templating" rel="nofollow noreferrer">https://craftcms.com/docs/categories-fields#templating</a></p>
  
  <pre><code>{% set categories = restaurant.categoryFieldHandle %}
  </code></pre>
  
  <p>That will assign all of the categories to a variable named <code>category</code>.  If you know there will only ever be one, then you can use:</p>
  
  <pre><code>{% set categories = restaurant.categoryFieldHandle.first() %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-26T22:37:16.747Z
Answers.LastActivityDate: 2017-03-26T22:37:16.747Z
Answers.UserDisplayName: Brad Bell
Body: <p>How can I display category name on template used in user->group.</p>
  
  <pre><code>{% for restaurant in craft.users.username(userId) %}
      {{ restaurant.name }}
      {{ restaurant.addressLine1 }} {{ restaurant.addressLine2 }}
      --
      // display the category name which has been added in restaurant-&gt;Group under Users
      --
  {% endfor %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-09T19:59:31.527Z
Comments.Text: Hi Mohit, would you mind following up on this question and letting us know if Brad's answer solved it or if you found your own way? You can add and accept your own answer here if you want!
Comments.UserDisplayName: Matt Stein
Tags: <templating><users><categories>
Title: Fetch category name
ThreadText: # Fetch category name
  
  (Asked by: username_0 on 2017-03-25)
  
  How can I display category name on template used in user->group.
  
  ```
  {% for restaurant in craft.users.username(userId) %}
      {{ restaurant.name }}
      {{ restaurant.addressLine1 }} {{ restaurant.addressLine2 }}
      --
      // display the category name which has been added in restaurant->Group under Users
      --
  {% endfor %}
  
  ```
  
  **Tags:** templating, users, categories
  
  > **Comments:**
  > **username_1**: Hi username_0, would you mind following up on this question and letting us know if username_2's answer solved it or if you found your own way? You can add and accept your own answer here if you want!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-03-26. Score: 1
  
  If I'm following you, you've got restaurants set up as user accounts in Craft and you've got a category field assigned to the Users field layout and you're trying to access those categories.
  
  If so, it's as simple as it is in the docs: <https://craftcms.com/docs/categories-fields#templating>
  
  ```
  {% set categories = restaurant.categoryFieldHandle %}
  
  ```
  
  That will assign all of the categories to a variable named `category`. If you know there will only ever be one, then you can use:
  
  ```
  {% set categories = restaurant.categoryFieldHandle.first() %}
  
  ```
  
  
  ---
  
  