+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Extra membership info user signs up

Extra membership info user signs up

7 posts, 0 answered
  1. Peter
    Peter avatar
    10 posts
    Registered:
    24 Aug 2008
    30 Jan 2009
    Link to this post
    Hi there,

    I've been trawling the developer manual and the forum for info on howto add extra data like address, zip code, city, country etc. when the user signs up on my site. And I haven't been able to find any examples on this. Could any of you please point me in the right direction for info on this problem?

    Regards Peter
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    30 Jan 2009
    Link to this post
    Hello Peter,

    Here is an example of adding such a field:
    web.config:
    <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 NEW NAME HERE-->     
            <add name="ExampleField" type="System.String"/>     
     

    If you want to show this filed in the administration side, you should add a control with the same ID (as the name of the field added in the web.config) in [YourProject]\Sitefinity\Admin\CmsAdmin\Users.aspx:
    <asp:Literal ID="Literal6" runat="server" Text="<%Resources:UserDetails%" /></h3>     
        <fieldset class="userinfo set">     
            <cc1:ManageProfile ID="manageProfile" runat="server" Mode="Insert">     
                <InsertTemplate>     
                    <ol class="setIn">     
                        <li>     
                            <cc2:FieldLabel ID="lblFirstName" runat="server" Text="First name" TargetID="FirstName">     
                            </cc2:FieldLabel>     
                            <asp:TextBox ID="FirstName" runat="server"></asp:TextBox></li>     
                        <li>     
                            <cc2:FieldLabel ID="lblLastName" runat="server" Text="Last name" TargetID="LastName">     
                           </cc2:FieldLabel>     
                            <asp:TextBox ID="LastName" runat="server"></asp:TextBox></li>     
                            <li><cc2:FieldLabel ID="lblExampleField" runat="server" Text="ExampleField" TargetID="ExampleField">     
                        </cc2:FieldLabel>     
    <asp:TextBox ID="ExampleField"runat="server"></asp:TextBox></li>      
                    </ol>     
                </InsertTemplate>     
            </cc1:ManageProfile>     
     

    Here is an example on how to use this field in your code:
    (This sample code iterates through all users from the role "administrators")
    UserManager manager = new UserManager();    
    IList cmsUsers = manager.GetUsersInRole("administrators");    
    foreach (string user in cmsUsers)    
    {    
        ProfileBase userProfile = ProfileBase.Create(user);    
        string fieldValueSomething = (string)userProfile.GetPropertyValue("ExampleField");    
    }    

    I hope this helps. Let me know if you have any other questions.

    All the best,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Peter
    Peter avatar
    10 posts
    Registered:
    24 Aug 2008
    02 Feb 2009
    Link to this post
    Thanks, Georgi. You are a life saver!

    Regards,

    Peter
  4. eric
    eric avatar
    4 posts
    Registered:
    01 Feb 2009
    26 Feb 2009
    Link to this post
    I can't seem to find ProfileBase class.  Please tell me which namespace it is under? Thanks,
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    26 Feb 2009
    Link to this post
    Hello eric,

    Namespace:  System.Web.Profile
    Assembly:  System.Web (in System.Web.dll)

    Take a look at http://msdn.microsoft.com/en-us/library/system.web.profile.profilebase.aspx for more information.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Kieran
    Kieran avatar
    56 posts
    Registered:
    14 Aug 2008
    19 Aug 2010
    Link to this post
    Hi Georgi, 

    I have updated the web.config.

    I am trying to create a bespoke registration form. 
    That takes in extra info. 

    How do I store these values??

    MembershipCreateStatus status;
            UserManager um = new UserManager("Sitefinity");
     
            MembershipUser user = um.CreateUser(username, password, email, null, null, true, null, out status);
             
            ProfileBase profile = ProfileBase.Create(username);
                     
           // Roles.AddUserToRole(username, "Premium Users");
     
            if (profile.IsDirty)
            {
                profile.Save();
     
            }


    Regards
    Kieran
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Aug 2010
    Link to this post
    Hi Kieran,

    There is a method of ProfilBase object - SetPropertyValues that you can use.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
7 posts, 0 answered