We wanted to add cutom properties to the Users profile, so we could create a members directory control to show the members or employees of a company or organization without having to maintain separate statis page. But we needed an additional field for the employess biography.
So here were my steps.
Sitefinity uses Microsofts Membership provider and RoleManager provider so the first thing we have to do is modify the provider and and a new property.
This is a very simple task, we just modify the web.config file as follows
1.Open the application web.config file. Find this section and add the new profile property:
<profile defaultProvider="Sitefinity">
<providers>
<clear/>
<add name="Sitefinity" connectionStringName="DefaultConnection" applicationName="/" type="Telerik.DataAccess.AspnetProviders.TelerikProfileProvider, Telerik.DataAccess"/>
</providers>
<properties>
<add name="FirstName"/>
<add name="LastName"/>
<add name="Bio"/>
</properties>
</profile>
2. To display the field at the Administration > Create/Edit User screens, open the
~/Sitefinity/Admin/CmsAdmin/Users.aspx file add the lines in red:
A.
<cc1:ManageUsers runat="server" ID="manageUsers">
...
<InsertTemplate>
...
<div class="workArea">
<div class="mainForm">
...
<fieldset class="userinfo set">
<cc1:ManageProfile ID="manageProfile" runat="server"
Mode="Insert">
<InsertTemplate>
<ol class="setIn">
<!-- Add the new profile field HERE. For example:
<li>
<cc2:FieldLabel ID="lblBio" runat="server" Text="Bio" TargetID="Nickname"></cc2:FieldLabel>
<asp:TextBox
ID="Nickname"
runat="server"></asp:TextBox>
</li>
-->
B.
<cc1:ManageUsers runat="server" ID="manageUsers">
...
<EditTemplate>
...
<div class="workArea">
<div class="mainForm">
...
<fieldset class="userinfo set">
<cc1:ManageProfile ID="manageProfile" runat="server"
Mode="Insert">
<EditTemplate>
<ol class="setIn">
<!-- Add the new profile field HERE. For example:
<li>
<cc2:FieldLabel ID="lblNickname" runat="server"
Text="Nickname"
TargetID="Nickname"></cc2:FieldLabel><asp:TextBox
ID="Nickname"
runat="server"></asp:TextBox>
</li>
-->
3. To allow users to change their nickname in My Profile, open the
~/Sitefinity/Admin/CmsAdmin/MyProfile.aspx file and add the field as shown below:
<asp:MultiView runat="server" ID="MultiView1">
<asp:View runat="server" ID="ProfileView">
<div class="workArea insert">
<div class="mainForm">
...
<fieldset class="userinfo set">
<cc1:ManageProfile ID="manageProfile" runat="server"
Mode="edit">
<EditTemplate>
<ol class="setIn">
<!-- Add the new profile field HERE. For example:
<li>
<cc2:FieldLabel ID="lblNickname" runat="server"
Text="Nickname"
TargetID="Nickname"></cc2:FieldLabel><asp:TextBox
ID="Nickname"
runat="server"></asp:TextBox>
</li>
-->
Now all we have to do is create a custom Control to display the Users from the Membership provider in a directory page/