Appendix: Changing Content Visibility According to User Type

The ISAUTHENTICATED wrap-around element allows you to conditionally display or hide page content based on whether a user is Authenticated - i.e. logged in with valid credentials for your application. The enclosed content can be literal, such as a message to the user, or other elements that you only want to call when the user is logged in.

The element has the following syntax:

<%= ISAUTHENTICATED()%>
...content to render...
<%= %>

Notice that this syntax features a tag either side of the content you want to render. Everything within this pair of tags is affected by the tag's behaviour, and will be hidden unless the user is logged in.

The following example shows an ISAUTHENTICATED element that will show logged in users a short message.

<%= ISAUTHENTICATED()%>
<p>Login successful!</p>
<%= %>

Alternatively, if you want to display content to users who are not logged in - i.e. Not Authenticated - you can use the ISNOTAUTHENTICATED element. The following example shows an element that will only show the enclosed message to users who have not logged in.

<%= ISNOTAUTHENTICATED()%>
<p>Please login to continue</p>
<%= %>