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 Name | Description |
---|---|
This 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, FULLNAME | These 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/3 | The lines of a user's address |
POSTCODE | The user's postcode |
TELEPHONE | A land line number |
MOBILE | A 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 Name | Description |
---|---|
USERPROFILE | This hidden field loads the profile of the current user. See the notes below |
USERPROFILESAVE | This hidden field saves the content of the form as the user's updated profile. See the notes below |
The user's email address | |
DISPLAYNAME and DISPLAYNAMEBUILDER | This 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 Fields | Any of the fields in the standard USERPROFILE type |
Additional fields | Any 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:
The default function of the EMAIL field then loads the EMAIL element of the USERPROFILE:
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.
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.