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:Can Tag

Anything inside the user:can tag will only be rendered if the user has the specified permission.

Overview

User tags are designed for sites that have areas or features behind a login. The {{ user:can }} tag is used to check if the currently logged in user has a one or more specific permissions.

Example

Let's say we want a link to edit the current entry in the control panel if the user has the edit faq entries permission.

{{ user:can do="edit faq entries" }}
<a href="{{ edit_url }}">Edit this Page</a>
{{ /user:can }}

Super Users

Super users can always do everything, so no matter what you check for โ€” whether it exists as an actual permission or not โ€” it will always return true.

Canโ€™t

We also support the negative use case using {{ user:cant }} tags.

{{ user:cant do="anything" }}
<p>Aww, I'm sure that's not true! ๐Ÿ˜Š</p>
{{ /user:cant }}

Permissions List

Check out the the complete list of user permissions.

Parameters

permission|do

string

The permissions to check against. You can use the parameter permission or do, depending on you feel about the grammar of each case. Specify multiple permissions by pipe separating them: {{ user:can do="things|stuff" }}.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →