Customizing User Profile for User Manager
According the documentation for Sitecore 6.0, Sitecore maps each user with a single user profile. The profile contains user’s basic data such as full name, email and portrait and can be extended in order to add new fields that can be manipulated through the User Manager as well as by Sitecore’s API as explained later in this post.
The trick behind extending the user profile lies on the User data template, located at Core database, from which the additional fields could be added. There are two ways to implement custom fields:
- Extending the Default User Profile.
You just need to add new fields to existing User Profile. The change will be reflected for all users at Master Database.
- Implementing a Custom User Profile.
Creates new User Profile inheriting the Default profile; all custom fields are encapsulated in this new profile.
You must change at Master database the appropriate user profile through the User Manager to access the custom fields.
Useful to create personalized user profiles based on the domain, country, etc.
Extending the default User Profile for User Manager
To extend existing profile you need to edit the User data template at Core database adding the sections and/or fields that you require. Once the changes were saved, all users at Master database will be ready to set the custom values.
To perform this approach please follow the next steps:
- Select the Core database
- Open the Template Manager and select the User item. You can find it in the following path:
- Edit the template adding the fields you need. Sections can be added also.
- SAVE the changes.
- Select Master database and verify the new field is displayed at User Manager/Edit User page
Please notice the custom fields are displayed as Additional Properties at the Profile tab.
Implementing the Custom User Profile
The custom User Profile is created from the Default User data template. At Core database the User Profile data template is copied and the custom fields are added to the copy, then a new Profile definition must be created based on the new template. And finally the new Profile definition must be assigned to the users at Master database, this way the new fields would be ready to be edited.
To implement the custom user profile proceed with next steps:
- Select Core database.
- Open Template Manager and duplicate the User data template. Choose a proper name for new profile template... for exercise purposes it will called CustomUserProfile
Find the user data template under: templates/System/Security/User
- Add the custom fields in the CustomUserProfile.
- SAVE changes
- In Content Editor select the Profile folder: System/Settings/Security/Profiles
- Insert the CustomUserProfileDefinition new Item for the profile definition using the CustomUserProfile data template.
Tip: sort the CustomUserProfileDefinition at the top in order to be the default option when new items were created.
- Save your changes.
- Select Master database and open User Manager.
The new profile must be available at Master database.
You can assign it to the desired users (existing) replaced the default user profile or added to new users.
Once assigned to the user, you will be able to set the new fields for the selected user.
- Set the CustomUserProfile for the given User.
- In UserManager, select a user and click on the Edit command. The Edit User dialog will be displayed.
- In Edit User dialog click the Profile tab and click the Change button.
- The Change User profile dialog appears.
Please notice the profiles are sorted displaying the CustomUserProfile at the top of the list.
- In the Change User profile dialog pick up the CustomUserProfile.
The next time the user profile were displayed the additional fields would be enabled for editing in the Profile tab into the Additional Properties section.