Login test for user's group? 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 %}
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 of using getGroups at the template level.

Here is what that might look like within a 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!