Display & check-for User Group on public profile This two-part question is half an exact duplicate of How do you display a user&#39;s User Group? but I'm unable to leave a comment :(

I'm trying to display &amp; check-for the user group a user belongs to on a public profile page. There are coaches and players.

The URL structure is domain.com/coaches/johnnyappleseed

Copying the exact example code given in the original question (link above) seems to just return the User's full name, not the group the user belongs to. What could I be missing?

Also, if johnnyapplseed is a coach, I can still access his profile page by going to domain.com/players/johnnyappleseed which is why I'm trying to check for the usergroup to begin with. Is checking for the usergroup in each player &amp; coach profile template the correct way to do this?

UPDATE: I've attached a screenshot of all the information I think could possibly be relevant. This has to be something simple I'm overlooking!
If you know the user will only belong to one group, something like this should do it.

{% set user = craft.users.username(craft.request.getSegment(2)).first() %}

{# make sure we found a user %}
{% if user|length %}
    {% set groups = user.getGroups() %}

    {# make sure they belong to at least one group #}
    {% if groups|length %}
        {# display the name of the first group #}
        {{ groups[0].name }}
    {% endif %}
{% endif %}