Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Vineet Kothari 32 posts 53 karma points
    Apr 05, 2010 @ 05:17
    Vineet Kothari
    1

    Registration page for members

    Hi

    I wanted to add a registration page for members to the site which will let user to login to the site. I am trying to build an invitation portal where members would be able to create events & generate invitations to others.

    Help regarding this will be highly appreciated.

    Thanks

    Vineet

  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    Apr 05, 2010 @ 09:28
    Sebastiaan Janssen
    0

    Umbraco uses the ASP.NET membership provider model, if you're not familiar with it I'm sure Google can help you out. Basically you only need to slap a default membership control in your template. For other, more complex scenario's, you could create members yourself, or check out the ClientArea package (this sounds most like what you're trying to do).

  • Vineet Kothari 32 posts 53 karma points
    Apr 06, 2010 @ 05:18
    Vineet Kothari
    0

    Thanks Sebastiaan for your reply. I think I might have put in my question incorrectly. I am looking for a registration page. Lets say mine is a social networking website like facebook or myspace so if a new user comes he/she registers & his details are saved into the database. These details will be username, password, email, dob, address, cell & likewise. 

    You suggested ClientArea package which does not carry any registration options. It does have login option & forbidden page & restricted private pages which are good but I am looking for something from where a new user/member can register himself and get started & I dont want to manually create member everytime (this would not be best practice) 

    To summarize: I am looking for a module/package or any instructions from where anyone can register as a standard member for my umbraco website by filling out a registration form.

    I apologize if I wasn't clear. Your help is highly appreciated. 

    Thanks
    Vineet

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 06, 2010 @ 10:39
    Dirk De Grave
    0

    you could use asp.net createuserwizard control that'll do the registration for you. But you'll have to modify the registration templates to include the other info that needs to be saved to the db whenever a new member registers on the site through the member api.

     

    Hope this helps.

    Regards,

    /Dirk

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Apr 06, 2010 @ 15:56
    Nik Wahlberg
    0

    Hi Vineet, that following code-behind should do what you need. To accompay this, all you need is to drop a standard asp:CreateUserWizard in your user control and let'er rip! 

    // event call to add the user role...
    void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
        // after the user has been created, we need to pull up the member object...
        Member registeredMember = Member.GetMemberFromLoginName(CreateUserWizard1.UserName);
    
        // try to save the entire profile with all the data that we filled in...
        if (registeredMember != null && registeredMember.Id > 0) {
            try {
                //Member profile update based on info found in registration wizard
                MemberProfileUpdate(registeredMember);
            } catch {
                Log.Add(LogTypes.Custom, User.GetUser(0), Node.GetCurrent().Id,
                    new StringBuilder().Append("Error while persisting member profile info for member '").Append(registeredMember.Text).Append("' (").Append(registeredMember.Id).Append(")!").ToString());
            }
        }
    
        // do NOT login the user after the registration as we need to get some money first...
        CreateUserWizard1.LoginCreatedUser = false;
    }
    
    
    // Method takes all of our Web form data and associates it with out member record
    private void MemberProfileUpdate(Member member)
    {
        //Get profile info from regsitration wizard (form data)
        TextBox firstNameTextBox = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("FirstName");
        TextBox lastNameTextBox = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("LastName");
        ...
    
        // set the member properties (defined in Umbraco Members section)...
        member.getProperty("firstName").Value = firstNameTextBox.Text;
        member.getProperty("lastName").Value = lastNameTextBox.Text;
        ...
    
        //E-mail is set to username as e-mail is used as username
        member.Email = member.LoginName;
    
        //Set user friendly name for member node in admin backend
        if (!string.IsNullOrEmpty(nameTextBox.Text))
            member.Text = nameTextBox.Text;
    
        // add member to a group that we've specified (in this case passed in via macro param)
        MemberGroup addToMemberGroup = MemberGroup.GetByName(this._memberGroupName);
        member.AddGroup(addToMemberGroup.Id);
    
        // save the Umbraco member (persist to DB)
        member.Save(); 
    }

    Good luck!

    -- Nik

  • Vineet Kothari 32 posts 53 karma points
    Apr 08, 2010 @ 06:35
    Vineet Kothari
    0

    Thanks Dirk & Nik.

    I'll try that & keep you guys posted. I even found something on nibble.be will try that too & see which way suits better to me :)

  • Vineet Kothari 32 posts 53 karma points
    Apr 11, 2010 @ 14:14
    Vineet Kothari
    0

    Nik

    I liked your solution though but unfortunately I am not a great programmer myself esp. in .NET rather a very basic beginner so if you can give me the steps or instructions that would be great.

    I tried the instructions at by Nibble at http://www.nibble.be/?p=20 but I dont know why but it gives this error

    No Contenttype with id: 1040

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    I wish to get registration form & later display the profile & let the member edit his information from something like "My Account" after he logs in.

  • Randall Fish 1 post 21 karma points
    May 21, 2010 @ 02:53
    Randall Fish
    0

    Error parsing XSLT file: \xslt\forum-commentsList.xslt

  • Nate 143 posts 184 karma points
    Dec 01, 2010 @ 15:16
    Nate
    0

    Nik, thank you for this post!

    This is what i've been looking for for about two hours :).  Everything else is so complicated.

    Thanks!

  • Bob Jones 33 posts 54 karma points
    Jan 03, 2012 @ 18:36
    Bob Jones
    0

    I have tried to follow Nik's example but the nameTextBox and ._memberGroupName are not recogised in the visual studio complier. Could anyone tell me what else I am missing?

  • Bob Jones 33 posts 54 karma points
    Jan 03, 2012 @ 18:39
    Bob Jones
    0

    ok I have figured that the is now a first and last name text box with the Create User wizard but am still stuck on the ._memberGroupName bit..

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 03, 2012 @ 19:14
    Tom Fulton
    1

    It's probably just a variable not shown in his code, with the name of a Group you want to add the new member to.  Just replace it with "YourGroupName" or add string _memberGroupName = "YourGroupName" (whatever your group name is), or even remove it if you don't want to add them to any group.

    Also if you need an updated example check out Mike Taylor's 4 part blog series:  http://umbraco.miketaylor.eu/2010/08/29/authenticating-new-members/

    -Tom

  • Bob Jones 33 posts 54 karma points
    Jan 04, 2012 @ 12:38
    Bob Jones
    0

    I can't get this code working (which is more or less Nik's example):

    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) {
    // after the user has been created, we need to pull up the member object...
    Member registeredMember = Member.GetMemberFromLoginName(CreateUserWizard1.UserName);

     

    // try to save the entire profile with all the data that we filled in...
    if (registeredMember != null && registeredMember.Id > 0) {
    try {
    //Member profile update based on info found in registration wizard
    MemberProfileUpdate(registeredMember);
    } catch {
    Log.Add(LogTypes.Custom, User.GetUser(0), Node.GetCurrent().Id,
    new StringBuilder().Append("Error while persisting member profile info for member '").Append(registeredMember.Text).Append("' (").Append(registeredMember.Id).Append(")!").ToString());
    }
    }

     

    // do NOT login the user after the registration as we need to get some money first...
    CreateUserWizard1.LoginCreatedUser = false;
    }

      

    // Method takes all of our Web form data and associates it with out member record
    private void MemberProfileUpdate(Member member) {
    //Get profile info from regsitration wizard (form data)
    TextBox userNameTextBox = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName");

      

    // set the member properties (defined in Umbraco Members section)...
    member.getProperty("UserName").Value = userNameTextBox.Text;

     

    //E-mail is set to username as e-mail is used as username
    member.Email = member.LoginName;

     

    //Set user friendly name for member node in admin backend
    if (!string.IsNullOrEmpty(userNameTextBox.Text))
    member.Text = userNameTextBox.Text;

     

    // add member to a group that we've specified (in this case passed in via macro param)
    MemberGroup addToMemberGroup = MemberGroup.GetByName("Standard");
    member.AddGroup(addToMemberGroup.Id);
    member.ContentType = MemberType.GetByAlias("SiteMember");
    // save the Umbraco member (persist to DB)
    member.Save();
    }

     

    So many umbraco examples I find are out of date now, could someone help me with this? The debugger simply refuses to work with this code also so I have no idea where it is going wrong.

Please Sign in or register to post replies

Write your reply to:

Draft