Answers.Body: <p>You could combine your conditions like so:</p>
  
  <pre><code>{% if currentUser and currentUser.isInGroup('wholesalers') %}
    Do something here...
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-01T15:39:47.667Z
Answers.Text: Thx @Luke Pearce
Answers.UserDisplayName: Britchie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-01T07:34:48.233Z
Answers.LastActivityDate: 2016-09-01T07:34:48.233Z
Answers.UserDisplayName: Luke Pearce
Answers.Body: <p>You could use a <code>switch</code> statement or an <code>if</code> statement using <code>getGroups()</code>.</p>
  
  <p>Instead of me taking all the credit, <a href="https://craftcms.stackexchange.com/questions/1578/how-do-you-display-a-users-user-group">here is a great thread along with an example</a> of using <code>getGroups</code> at the template level.</p>
  
  <p>Here is what that might look like <a href="https://craftcms.stackexchange.com/questions/12762/get-groups-from-user-in-plugin">within a plugin</a>.</p>
  
  <p>To get the actual ID of the group - I'm sure there is a more scientific way, but If I'm always going to know what the ID is, I'll just hover over the handle and look at the url. It will be something like <code>/settings/users/groups/2</code>.</p>
  
  <p>Hope this helps!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-01T15:37:36.867Z
Answers.Text: Thx @Damon. Saw that. It'll be useful when I need to pull some other info. If the Craft folks are watching this thread, there's a feature request here to surface this is the UI.
Answers.UserDisplayName: Britchie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-01T03:07:41.537Z
Answers.LastActivityDate: 2016-09-01T03:07:41.537Z
Answers.LastEditDate: 2017-04-13T12:51:00.303Z
Answers.UserDisplayName: Damon
Body: <p>I want to display some content only if a user from a certain group (wholesalers) is currently logged-in. The following syntax seems to work - but is there something more shorthand than the nested conditionals I'm using?</p>
  
  <pre><code>{% if currentUser %}
      {% if currentUser.isInGroup('wholesalers') %}
          Do something here...
      {% endif %}
  {% endif %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-01T01:07:51.990Z
Comments.Text: Also, where do I find the group ID # for the user groups I've set-up?
Comments.UserDisplayName: Britchie
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-01T15:43:07.447Z
Comments.Text: You can find that by navigating to the group settings in the CP and looking at the URL. It will be something like `admin/settings/users/groups/4` the number is the group ID.
Comments.UserDisplayName: Luke Pearce
Tags: <conditional><login>
Title: Login test for user's group?
ThreadText: # Login test for user's group?
  
  (Asked by: username_0 on 2016-09-01)
  
  I want to display some content only if a user from a certain group (wholesalers) is currently logged-in. The following syntax seems to work - but is there something more shorthand than the nested conditionals I'm using?
  
  ```
  {% if currentUser %}
      {% if currentUser.isInGroup('wholesalers') %}
          Do something here...
      {% endif %}
  {% endif %}
  
  ```
  
  **Tags:** conditional, login
  
  > **Comments:**
  > **username_0**: Also, where do I find the group ID # for the user groups I've set-up?  
  > **username_1**: You can find that by navigating to the group settings in the CP and looking at the URL. It will be something like `admin/settings/users/groups/4` the number is the group ID.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-09-01. Score: 0 | Accepted answer
  
  You could combine your conditions like so:
  
  ```
  {% if currentUser and currentUser.isInGroup('wholesalers') %}
    Do something here...
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thx @username_1  
  
  ---
  
  ### Answer by username_2 on 2016-09-01. Score: 1
  
  You could use a `switch` statement or an `if` statement using `getGroups()`.
  
  Instead of me taking all the credit, [here is a great thread along with an example](https://craftcms.stackexchange.com/questions/1578/how-do-you-display-a-users-user-group) of using `getGroups` at the template level.
  
  Here is what that might look like [within a plugin](https://craftcms.stackexchange.com/questions/12762/get-groups-from-user-in-plugin).
  
  To get the actual ID of the group - I'm sure there is a more scientific way, but If I'm always going to know what the ID is, I'll just hover over the handle and look at the url. It will be something like `/settings/users/groups/2`.
  
  Hope this helps!
  
  > **Comments:**
  > **username_0**: Thx @username_2. Saw that. It'll be useful when I need to pull some other info. If the Craft folks are watching this thread, there's a feature request here to surface this is the UI.  
  
  ---
  
  