{% unset_profile_setting %}

Unsets custom profile settings on the currently logged-in profile. This tag is meaningless unless the user is logged in. For settings with a default value this will reset them to the default. For all other settings this will set them to empty/unselected/false.

Profile settings may be required and include validation. All settings will be validated before being set and any validation error will prevent any settings from being unset. Validation errors may optionally be output to a variable.

Syntax

{% unset_profile_setting
[var|set|assign] errors = new_variable_name
If there are any validation errors encountered while unsetting the specified settings, they will be stored in this variable name. If not specified than the validation errors will simply not be saved. The variable will be saved using the "var" behavior unless "set" or "assign" are specified.
setting_name
Include one or more settings to unset on the profile.
...
%}

You may also include reference variables, which will be dereferenced to their property names before unsetting the profile settings.

There is no option to unset all settings on a profile - settings must be unset by name.

Examples

Unset Profile Setting

Copy
{% if request.post_params.clear_description %} {% unset_profile_setting description %} {% endif %}

Unset multiple Profile settings

Copy
{% if submission.is_valid and submission.score.value < 80 %} {% unset_profile_setting passed_certification_exam certification_category %} {% endif %}

Unset Profile settings dynamically

Copy
{% var clearsettings = request.post_params.clearsettings | split: ',' | join:' ' %} {% if clearsettings is_valid %} {% unset_profile var errors = profile_errors *clearsettings %} {% if profile_errors %} {% for error in profile_errors %}

Error clearing {{error.Key}}: {{error.Value}}

{% endfor %} {% endif %} {% endif %}