Skip to main content
replaced http://craftcms.stackexchange.com/ with https://craftcms.stackexchange.com/
Source Link

Here is a basic template that requires login, and checks that the currently logged-in user is in the user group 'clients'.

{% extends "_layout" %}
{% requireLogin %}    

{% block content %}

    {% if currentUser.isInGroup( craft.userGroups.getGroupByHandle('clients') ) %}

        {# Only viewable by logged in users that belong to 'clients' user group #}    
        Restricted client content goes here.

    {% else %}
        
        {# Viewable by logged in users not in the user group 'clients' #}
        Notice to other user groups that this content is restricted to clients only.

    {% endif %}

{% endblock %}

You may also want to check out this questionthis question for more examples.

Here is a basic template that requires login, and checks that the currently logged-in user is in the user group 'clients'.

{% extends "_layout" %}
{% requireLogin %}    

{% block content %}

    {% if currentUser.isInGroup( craft.userGroups.getGroupByHandle('clients') ) %}

        {# Only viewable by logged in users that belong to 'clients' user group #}    
        Restricted client content goes here.

    {% else %}
        
        {# Viewable by logged in users not in the user group 'clients' #}
        Notice to other user groups that this content is restricted to clients only.

    {% endif %}

{% endblock %}

You may also want to check out this question for more examples.

Here is a basic template that requires login, and checks that the currently logged-in user is in the user group 'clients'.

{% extends "_layout" %}
{% requireLogin %}    

{% block content %}

    {% if currentUser.isInGroup( craft.userGroups.getGroupByHandle('clients') ) %}

        {# Only viewable by logged in users that belong to 'clients' user group #}    
        Restricted client content goes here.

    {% else %}
        
        {# Viewable by logged in users not in the user group 'clients' #}
        Notice to other user groups that this content is restricted to clients only.

    {% endif %}

{% endblock %}

You may also want to check out this question for more examples.

Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57

Here is a basic template that requires login, and checks that the currently logged-in user is in the user group 'clients'.

{% extends "_layout" %}
{% requireLogin %}    

{% block content %}

    {% if currentUser.isInGroup( craft.userGroups.getGroupByHandle('clients') ) %}

        {# Only viewable by logged in users that belong to 'clients' user group #}    
        Restricted client content goes here.

    {% else %}
        
        {# Viewable by logged in users not in the user group 'clients' #}
        Notice to other user groups that this content is restricted to clients only.

    {% endif %}

{% endblock %}

You may also want to check out this question for more examples.