Refers to the current portal user, allowing access to all attributes of the underlying CRM contact record. If no user is signed in, this variable will be null.

user is an entity object.

{% if user %}
Hello, {{ user.fullname }}!
{% else %}
Hello, anonymous user!
{% endif %}

Attributes

In addition to having all of the attributes of an entity object, user has the following attributes.

roles

Returns the roles to which the user belongs, as an array.

{% if user.roles contains 'Administrators' %}
User is an administrator.
{% endif %}

basic_badges_url

Requires Adxstudio Badges 7.0.0001

Returns the service url to retrieve a user's badges.

To render badges for a user you must include a tag with the attributes "data-badge" and "data-uri". To render the current user's badges:

<div data-badge data-uri='{{user.basic_badges_url }}'></div>

To render out a user's badges by id (variable userid):

<div data-badge data-uri='{{user.basic_badges_url | replace_first: user.id, userid}}'><div>