{{ user }}

The user object is available on every page, and contains all available information about the user who requested the current page. Note that most of these properties are only meaningful if the site has enabled front-end login and the user is currently logged in.

The user object is one of a handfull of simple mechanisms to enable personalization on your site. Used well, these can be powerful tools for developers and website owners.

Properties

string object_type
Will always be "user".
true/false is_valid
True if the user is logged in.
guid guid
The unique identifier for the user.
true/false guest
True if the user is not logged in.
true/false visitor
Alias for guest.
true/false logged_in
True if the user is logged in.
date login_date
The time that the user logged in to the site (in UTC).
list properties
The full list of custom properties that have been set for the current user. This list only includes the keys, the values will have to be retrieved using the keys.

Individual custom properties for the user may be accessed using {{ user.propertyName }} or {{ user['propertyName'] }} syntax.

You may also treat this object as a list containing all of the property names which may be iterated using a {% for %} loop. For more details, see the examples below:

Examples

{% if user.logged_in %}
    <p>Do something</p>
{% else %}
    <p>Do something else</p>
{% endif %}

List all custom properties for the current user:

<h4>User Properties:</h4>
<ul>
    {% for property in user %} --equivalent to {% for property in user.properties %}
        <li><strong>{{property}}</strong> = {{ user[property] }}</li>
    {% endfor %}
</ul>

Working with specific custom properties

{% if user.is_valid %}
    {% if user.custom_property_name %}
        <p>Custom Property: {{user.custom_property_name}}</p>
    {% endif %}
    {% if user['custom_property_name_2'] %}
        <p>Custom Property 2: {{user['custom_property_name_2']}}</p>
    {% endif %}
{% endif %}

Developer Overview

Liquid Markup