I am building a community website that currently have two user groups but it might increase so I am trying to automate everything. The current groups are: 'teachers' & 'candidates'.
I have a channel section named 'Community' and for this channel I have setup a category group called 'Community' that has two categories named as the user groups: 'teachers' & 'candidates'.
I am trying to display a list of all the registered users in a specific group as you are loading the category template.
This is the template that is being loaded:
{% extends "community/index" %}
{% set title = category.title %}
{% block main %}
<h1>{{ category.title }}</h1>
{% set group = craft.users.group('{{ category.slug }}') %}
{% for user in group %}
<li>{{ user.name }}</li>
{% endfor %}
{% endblock %}
I was thinking that since the {{ category.slug }}
has the same name as the user group, it can work but apparently not...
Can someone help me to understand how to relate the two?
{{ category.slug }}
onto the page, is it what you're expecting? – Brad Bell Jan 3 '16 at 19:33{{ category.slug }}
outputs eitherteachers
orcandidates
? – Brad Bell Jan 3 '16 at 20:05