Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

For a software dev like me who has no idea how to create a cute hand-drawn dashed line, this course just 100% works.

— Ira Zayats, Developer

User_Roles Tag

The user_roles tag is used to return any roles you have added to collate the users on your site.

Overview

The User Roles tag fetches lists of the user roles on your site so you can do whatever you want with them.

A simple example is to loop through all the roles and list them by handle:

<ul>
{{ user_roles }}
<li>{{ handle }}</li>
{{ /user_roles }}
</ul>

Filtering

If you only want a specific role or roles, you can pass their handle(s) using the handle parameter.

{{ user_roles handle="group_1|group_2" }}
// cool stuff goes here
{{ /user_roles }}

Parameters

handle

string

The handle(s) of the roles you want to return. You may specify multiple roles by pipe separating them: {{ user_roles handle="jocks|geeks" }}.

Variables

Variable Type Description

handle

string

The role's unique identifier.

title

string

The role's display title.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →