Profile

Profile

{{ profile }}

Name Type Description
object_type String Will always be datastore_item
is_valid Boolean True if this references a published profile
guid String The unique identifier for this profile
value String Contains the same value as guid
id String The identifier for the profile. May or may not be the same as email, depending on the site settings
email String Email address for this profile
force_password_reset Boolean If true, the user must reset their password at next login
is_active Boolean If true, the profile is active and can be used. If false, the profile must be activated before it may be used
date_activated time The date that this profile was activated
date_activation_code_expires time The date when the activation code will expire and no longer be valid
date_first_activated time The date of the first successful activation for this profile
is_locked Boolean If true, this profile is temporarily locked and may not be used to sign in until it is unlocked
date_locked_through time If this profile is locked, this will be set to the date that the profile will be automatically unlocked
date_last_logged_in time The date that this profile was last used to sign in to the website
is_blocked Boolean If true, this profile has been permanently blocked and may not be used to sign in
date_blocked time If this profile is blocked, this will be set to the date when the profile was blocked
attributes dictionary The custom attributes for this profile. Attributes may either be manually set in the Marketpath CMS UI or programmatically set from template markup
logged_in Boolean True if this profile is presently logged in on the current request
can_login Boolean True if the profile exists, is active, and is not blocked or locked
settings object An object containing all of the custom profile settings for this profile
field_id String The identifier for this field
label String The label for this field
output String The default output that the profile produces when output directly to the template. Currently simply outputs the email, but the default output may change at any time. Template developers should avoid using this and should handle the output of profiles themselves

{{ profiles }}

Contains multiple profiles.

Name Type Description
output String The default output that the profiles will produce when it is output directly to the template - using the "output_in_list" property of each profile in the items list

{% profile %}

{% profile
var|set|assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this profile is stored on. "var" is the default behavior.
variable_name
 
Specify a variable name in order to save this profile to a variable. If not specified, it will be output to the template instead.
output_to_template
 
If included the profile will be output directly to the template.
=
%}

{% profiles %}

{% profiles
var|set|assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this profiles is stored on. "var" is the default behavior.
variable_name
 
Specify a variable name in order to save this profiles to a variable. If not specified, it will be output to the template instead.
output_to_template
 
If included the profiles will be output directly to the template.
=
prepend:value
 
Prepend the specified profiles before the fetched results. All prepended input will be returned in the same order that it is input. Value may one or more profiles, a guid, or a string.
append:value
 
Append the specified profiles after the fetched results. All appended input will be returned in the same order that it is input. Value may one or more profiles, a guid, or a string.
exclude:value
 
Prevent the specified profiles from being included in the fetched results. Has no affect on prepended and appended items. Value may one or more profiles, a guid, or a string.
exclude_prepended:true
 
Specifically exclude all prepended profiles from the fetched results. If "unique:true" is specified this is the default behavior, although you may also specify "exclude_prepended:false" to allow any prepended items to be fetched along with other results anyway.
exclude_appended:true
 
Specifically exclude all appended profiles from the fetched results. This is false by default - even if "unique:true" is specified - so that results are returned in the proper order.
unique:true
 
If set to true, each of the resulting lists (prepended, fetched, appended, and items) will be unique, although there may be duplicates between the prepended, fetched, and appended lists. The "items" list will include objects in the order in which they appear - with prepended items first, then fetched items, then appended items.
max_size:number
 
If specified, then the "items" list will only include up to the specified number of profiles. The "limit" may be automatically lowered to only fetch the maximum number of articles that will be included in "items" following prepended items. Note that this may also impact both the "page" and "total_pages" values. In order to use pagination with a list loaded using "max_size" use "start" instead of "page" and "limit".
%}

{% 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.

{% 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.

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

{% 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.

{% 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.

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

Examples

Set Profile

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

Set Profile Setting 2

Copy
{% var new_layout = request.post_params['layout'] %} {% var new_companyname = request.post_params['companyname'] %} {% var new_description = request.post_params['description'] %} {% set_profile_setting var errors = profile_errors layout:new_layout companyname:new_companyname description:new_description %} {% if profile_errors %} {% for error in profile_errors %}

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

{% endfor %} {% 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 %}

Unset Profile properties dynamically

Copy
{% var clearprops = request.query_params.clearprops | split: ',' | join:' ' %} {% if clearprops is_valid %} {% unset_profile *clearprops %} {% 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 multiple Profile properties

Copy
{% if submission.is_valid and submission.score.value < 80 %} {% unset_profile passed_certification_exam user_is_certified_for_x %} {% endif %}

Set Profile Setting 1

Copy
{% if submission.is_valid and submission.score > 70 %} {% set_profile_setting passed_test:'true' %} {% endif %}

Unset Profile Setting

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

Unset Profile

Copy
{% if request.query_params.hide_the_money %} {% unset_profile show_me_the_money %} {% endif %}