{% set_user %}

Saves custom properties on the user that will be accessible whenever the current user is logged in. Note that this is meaningless unless the user has allowed sessions and is logged in. Otherwise you will be able to set and retrieve user properties but they will not be saved for future reference.

Syntax

{% set_user property1:value1 [property2:"value 2"] ... %}

You may also include reference variables as properties, which will be dereferenced to their property names before setting the user properties.

Examples

{% if submission.is_valid %}
    {% var bestScoreName = form.name.value | prepend:'bestscore-' %}
    {% var bestScore = submission.score | to_int %}
    {% var previousBestScore = user[bestScoreName] | to_int %}
    {% if previousBestScore > bestScore %}
        {% set bestScore = previousBestScore %}
    {% endif %}
    {% set_user last_score:submission.score &bestScoreName:bestScore %}
{% endif %}

Developer Overview

Liquid Markup