Statamic - Checking User Status in Templates


Statamic provides flexible options for checking user login and permissions. This becomes particularly useful when you want to display links or navigation entries only if the user has the corresponding permission or status.

Login Status Check

Use the following tag to verify a user's login status:

{{ if logged_in }}
	You are logged in!
{{ /if }}

Access to the Administration Area / Control Panel

In the Statamic CMS, the administration area is referred to as the "Control Panel". Use the following tags to check within a template whether a user has access to it:

{{ user:can do="access cp" }}
    <a href="/cp">Control Panel</a>
{{ /user:can }}

Permission to Edit Entries

To display an editing link under an entry only if the user has the necessary rights, use the following tag:

{{ user:can do="edit blog entries" }}
    <a href="{{ edit_url }}">Edit post</a>
{{ /user:can }}

In this example, blog should be replaced with the name of the desired collection.