0%

Custom Profile Settings ID: PRFL-DEV-CPS

By default, Marketpath CMS Profiles are simple login accounts that can be used to secure private content on your Live website. They consist of an Email, a unique ID, and a password. However, similar to Marketpath CMS templates and datastores, you can add any number of custom fields to a Profile. These fields appear when an editor creates a new profile or updates an existing one.

To create a Custom Profile Setting, go to Develop -> Custom Profile Settings and click New. This will open the New Custom Profile Setting dialog (fig 1).

new-custom-profile-setting
Figure 1 - New Custom Profile Setting

Give the setting a name using just letters, numbers, dashes, or underscores. Then select a field type (fig 2). This is just like adding fields to templates where you can add standard form fields or fields that link to other existing content.

new-custom-profile-select-field
Figure 2 - Select a field type

After selecting a field type you can provide a friendly Label and a Default Value for that field.

Under the Advanced group, you can provide Subtext which will appear as hints when the “i” icon is hovered over. Placeholder can also be added which shows a value in the field when it is empty. This is good for conveying example data.

Under the Validation group, you can check if you want the field to be Required and set up custom Validators to ensure data integrity.

Custom Profile Settings Liquid Code

To access Custom Profile Settings in Liquid, you can use any of the following syntax:

{{ profile.setting_name }}
{{ profile[“setting_name”] }}
{{ profile.settings.setting_name }}
{{ profile.settings[“setting_name”] }}

To update a Custom Profile Setting during authentication, use the auth set_setting method:

{% auth set_setting setting_name:”Some value” %}

To update a Custom Profile Setting of the currently-logged-in profile, use the set_profile_setting method:

{% set_profile_setting setting_name:”Some value” %}

You can also unset a setting, that is, clear the value so it reverts to the default value (or no value if the setting does not have a default):

{% auth unset_setting setting_name %}
{% unset_profile_setting setting_name %}

 



Feedback?

Please fill out the form below with your feedback or any questions you may have after working through the "Custom Profile Settings" lesson.

Your Name
Email 
Feedback / Questions