I am trying to dynamically create new members with an asp .net CreateUserWizard user control in Umbraco 4.5. The problem I have is that I am unable to save the custom property values that I had added to my member type. It does save the username, email address, and password correctly.
I noticed that the Member.MakeNew method is obsolete. It says to use the System.Web.Security.Membership.CreateUser. If I use this method, how do I set the values for my custom property values of my member type?
Thanks
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles CreateUserWizard1.CreatedUser Dim lMemberType As MemberType Dim lNewMember As Member
If (Membership.GetUserNameByEmail(CreateUserWizard1.Email) Is Nothing) Then lMemberType = MemberType.GetByAlias("RegisteredUser")
lNewMember = Member.MakeNew(CreateUserWizard1.UserName, lMemberType, New BusinessLogic.User(0))
Dim lFirstName As cms.businesslogic.property.Property = lNewMember.getProperty("fname") Dim lFirstNameTextBox As TextBox = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("FirstName"), TextBox) lFirstName.Value = lFirstNameTextBox.Text
Dim lLastName As cms.businesslogic.property.Property = lNewMember.getProperty("lname") Dim lLastNameTextBox As TextBox = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("LastName"), TextBox) lLastName.Value = lLastNameTextBox.Text
Dynamically creating new members in Umbraco 4.5
Hi,
I am trying to dynamically create new members with an asp .net CreateUserWizard user control in Umbraco 4.5. The problem I have is that I am unable to save the custom property values that I had added to my member type. It does save the username, email address, and password correctly.
I noticed that the Member.MakeNew method is obsolete. It says to use the System.Web.Security.Membership.CreateUser. If I use this method, how do I set the values for my custom property values of my member type?
Thanks
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles CreateUserWizard1.CreatedUser
Dim lMemberType As MemberType
Dim lNewMember As Member
If (Membership.GetUserNameByEmail(CreateUserWizard1.Email) Is Nothing) Then
lMemberType = MemberType.GetByAlias("RegisteredUser")
lNewMember = Member.MakeNew(CreateUserWizard1.UserName, lMemberType, New BusinessLogic.User(0))
'lNewMember = Membership.CreateUser(CreateUserWizard1.UserName, CreateUserWizard1.Password, CreateUserWizard1.Email)
lNewMember.Email = CreateUserWizard1.Email
lNewMember.Password = CreateUserWizard1.Password
lNewMember.LoginName = CreateUserWizard1.UserName
Dim lFirstName As cms.businesslogic.property.Property = lNewMember.getProperty("fname")
Dim lFirstNameTextBox As TextBox = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("FirstName"), TextBox)
lFirstName.Value = lFirstNameTextBox.Text
Dim lLastName As cms.businesslogic.property.Property = lNewMember.getProperty("lname")
Dim lLastNameTextBox As TextBox = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("LastName"), TextBox)
lLastName.Value = lLastNameTextBox.Text
'lNewMember.getProperty("fname").Value = "Jeremy"
'lNewMember.getProperty("lname").Value = "Vo"
lNewMember.AddGroup(MemberGroup.GetByName("Registered Users").Id)
lNewMember.Save()
End If
End Sub
good post, i also wanted to how to create new member in 4.5 myself. but i think all admins are probably asleep now due to diff timezone =)
Lòng Dat Thóng
Unfortunately with Member.MakeNew being obsolete in v4.5 it's a bit more difficult to deal with custom properties. Here's one way of doing so:
http://www.aaron-powell.com/umbraco-members-profiles
I'd love to see someone come up with a simpler solution though. :$
Thanks for the reply. The tags in the webconfig from the example does not match the webconfig in umbraco 4.5.1. What are we missing?
is working on a reply...