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>
antlers

Filtering#

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

{{ user_roles handle="role_1|role_2" }}
// cool stuff goes here
{{ /user_roles }}
antlers

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 →