Toggle menu

User Profiles

A user profile stores information about a registered site user. Profiles are defined and managed using forms, and can be extended to include as many fields as you require.

Our standard installations use three forms to work with profiles:

  • USERPROFILE defines the underlying user profile object type
  • SITEUSERPROFILE is a public form published on your site
  • ICMSITEUSERPROFILE is a private form. Select this form in autoconfig (or your iCM settings) and it is used when editing users in iCM

User Profile Type Definition

User profiles have an underlying definition. This defines the data your site may hold about a user. The other user profile forms have this definition as their "external type" which allows different users, and different parts of the platform, to interact with profile data in different ways. There's more information about external types in the Forms and External Type Definitions knowledge base article.

The type definition is created by a form called USERPROFILE. All of the fields you want to include on the forms users interact with must also exist on this form.

Data Protection
Think carefully about the information you collect from users in their profiles. You should only collect the data you need to use in delivering services. For example, if you don't need to know a user's date of birth, don't include a field for it in your user profile forms.

Standard Fields

The only field your user profile definition must include is EMAIL. When users' names are displayed in other products, like the site user tree in iCM, or the search in Assisted Service, their names are built using the display name template in iCM's User Settings.

This table lists common fields we include on the standard user profile and use in the default display name template.

Field NameDescription
EMAILThis field holds the user's email address. All users must have an email address (in our standard registration process it's not possible to create a user account without an email)
FIRSTNAME, LASTNAME, PREFNAME, FULLNAMEThese fields hold the various parts of a user's name. A preferred name overrides the first name. A full name can override the combined first/pref and last name
ADDRESS1/2/3The lines of a user's address
POSTCODEThe user's postcode
TELEPHONEA land line number
MOBILEA mobile number

Searching

If you want to search for elements from a user's profile, either in iCM or site templates like Assisted Service, you need to set the fields in the USERPROFILE form as searchable. If you change the searchable setting for a field you'll need to reindex the site user search collection.

Site User Profile Form

A form called SITEUSERPROFILE is used by users to create and update their profiles. It is a public form with its external type set as your site's USERPROFILE type definition. This form is usually accessed from your site's My Account pages.

Standard Fields

This form has a number of hidden fields which load and save data, and hold the combined values of one or more other fields. You may have fields in the USERPROFILE type that aren't mirrored in this form - this is a useful way to store internal or system data against a user. If you want to add new fields to this form, remember to add them to the USERPROFILE type first.

Field NameDescription
USERPROFILEThis hidden field loads the profile of the current user. See the notes below
USERPROFILESAVEThis hidden field saves the content of the form as the user's updated profile. See the notes below
EMAILThe user's email address
DISPLAYNAME and DISPLAYNAMEBUILDERThis fields combine and store elements from a user's profile to build the name they will appear as on the site and in products like Assisted Service
Name and Address FieldsAny of the fields in the standard USERPROFILE type
Additional fieldsAny other fields from the USERPROFILE type

Loading a User Profile

When a user views the SITEUSERPROFILE form, the USERPROFILE (load) action field loads their current profile into a variable named after the field (ie a variable called USERPROFILE). This happens server-side. Values from the variable are used by the default functions of other fields to set their own starting values.

For example, this form loads a user's profile into a USERPROFILE variable:

Loading a Profile

The default function of the EMAIL field then loads the EMAIL element of the USERPROFILE:

Field Default Function

The user could then update their email address by changing the value of the field.

Display Name

Most website user accounts have randomly generated GUID "user names" that identify them. A user's actual name is held in their profile. When users appear in iCM or in products like Assisted Service, a template in the User Settings section is used to build the name you'll see. Within the user profile form, a hidden field called DISPLAYNAME combines a user's preferred, first and last names, which then gets used by the user settings templates.

Saving a User Profile

When a user submits the SITEUSERPROFILE form, the USERPROFILESAVE field saves their updated profile. The field's data function looks like this:

function(helper) {
    var userProfileData;
    userProfileData = helper.getVariable('USERPROFILE');
    if (userProfileData) {
        userProfileData.EMAIL = helper.getFieldValue('FORM_USERPROFILE.EMAIL');
        userProfileData.TITLE = helper.getFieldValue('FORM_USERPROFILE.TITLE');
        userProfileData.FIRSTNAME = helper.getFieldValue('FORM_USERPROFILE.FIRSTNAME');
        userProfileData.LASTNAME = helper.getFieldValue('FORM_USERPROFILE.LASTNAME');
        userProfileData.PREFNAME = helper.getFieldValue('FORM_USERPROFILE.PREFNAME');
    }
    return userProfileData;
}

The function sets properties in the userProfileData object to the values of the fields on the form. If you add or remove fields in your form, you'll also need to update the mappings in this function.

Custom Read Only View

Sometimes user profiles are displayed in other areas of the site where you wouldn't want them to be edited. The search results of the Assisted Service template is one example.

A read only view of a profile can either be displayed using the form fields themselves, or you can write a Custom Read Only template in the form settings section.

Custom Read Only

This Handlebars template gives you complete control over the read only view. The default templates, accessed using the Σ (sigma) icon in the Handlebars editor toolbar, will create a version that lays out all of the current fields in a table. It provides a good starting point you can then edit.

iCM User Profile Form

A third standard form is used by iCM to display profiles when editing users in iCM itself. It's called ICMSITEUSERPROFILE. It is a private form with its external type set as your site's USERPROFILE type.

The name of this form is set in iCM's autoconfig, and it is from this form that iCM works out the name of your USERPROFILE type.

Standard Fields

This form will generally include all of the fields in your USERPROFILE type so that your iCM admin users can access a user's full profile information.

There's no need to include profile load and save fields, or submit buttons, as this is all handled by iCM itself.

Last modified on June 21, 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon