Unset_profile

Unset_profile

{% unset_profile %}

Removes custom properties from the attribute dictionary of the currently logged-in profile. Note that this is meaningless unless the user is logged in.

{% unset_profile attributes %}

{% unset_profile
attributes
 
One or more values. May use the variable arguments syntax.
%}

There is no option to unset all attributes from a profile - attributes must be removed by name.

Related

{% unset_dictionary %}

Removes properties from an editable dictionary object. If the dictionary does not exist an empty one will be created and stored on the current scope. If the dictionary exists but is not editable this will throw an error.

{% unset_session %}

Removes custom properties from the session.

{% profile %}

{% unset_client %}

Removes custom properties from the client.

{% unset_client_permission %}

Removes the specified permissions from the permissions cookie. Note that this is not the same as denying permission since there will be no record that permission was either granted or denied after the permission has been unset.

{% set_profile_setting %}

Saves custom values to predefined profile settings that will be accessible whenever the current profile is logged in. Note that this is meaningless unless the user is logged in. Profile settings may include validation, in which case all settings will be validated before being set and any validation error will prevent the setting(s) from being set. Validation errors may optionally be output to a variable.

{{ profile }}

{% unset_profile_setting %}

Removes custom values from the profile settings for the currently logged-in profile. Note that this is meaningless unless the user is logged in. For settings with a default value this will reset them to the default, and for all other settings this will set them to empty/unselected/false. Profile settings may be required and include validation, in which case all settings will be validated before being removed and any validation error will prevent any settings from being set. Validation errors may optionally be output to a variable.

{% unset_cookie %}

"Unsets" one or more cookies. Because of how cookies work, this will actually ADD the cookie to the response with an expiration date in the past.

{% set_profile %}

Saves custom properties on the profile that will be accessible whenever the current profile is logged in. The properties will be saved to the profile's attribute dictionary. Note that this is meaningless unless the user is logged in.

Examples

Demonstrates how to unset Profile.

How to use the unset_profile method

Copy

Simple Use Case

{%- if request.query_params.hide_the_money -%}
{%- unset_profile show_me_the_money -%}
{%- endif -%}
Removes the "show_me_the_money" profile property if the "hide_the_money" query parameter is present.

Unset Profile Properties Dynamically

{%- var clearprops = request.query_params.clearprops | split: ',' | join:' ' -%}
{%- if clearprops is_valid -%}
{%- unset_profile *clearprops -%}
{%- endif -%}
Checks if the "clearprops" query parameter was included in the request, and if it was, converts the comma-delimited list of property names to a space-delimited list and unsets the profile properties with those names using the expanded variable syntax.

Unset Multiple Profile Properties

{%- if submission.is_valid and submission.score.value < 80 -%}
{%- unset_profile passed_certification_exam user_is_certified_for_x -%}
{%- endif -%}
Unset multiple profile properties at the same time. In this example, the template will unset the "passed_certification_exam" and "user_is_certified_for_x" properties if the submission is valid and the score is less than 80.