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.
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).
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.
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.
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();
}
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.
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?
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.
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)
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.
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
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).
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
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
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!
Good luck!
-- Nik
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 :)
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.
Error parsing XSLT file: \xslt\forum-commentsList.xslt
Nik, thank you for this post!
This is what i've been looking for for about two hours :). Everything else is so complicated.
Thanks!
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?
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..
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
I can't get this code working (which is more or less Nik's example):
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.
is working on a reply...