I'm working on my event calendar, and got very nice help on approaching the calender structure itself.
I'm starting to implement the calendar, and I need members to be able to login on the website, to be able to register for an event.
I've searched the forum, and I still don't understand how I'll be able to set custom properties on the members I create. I've created my own usercontrol, for creating the members because I need the members to be able to upload an Image, supply a Zipcode etc. Can anyone point me in the right direction?
From what I could find on the forum, the following should work (simplified):
MembershipUser user = myProvider.CreateUser(eMail, password, eMail, string.Empty, string.Empty, true, string.Empty, out createStatus);
And then:
Member m = Member.GetMemberFromLoginName(user.UserName); m.getProperty("Zipcode") = "9000";
I think you need to set the defaultMemberTypeAlias(UmbracoMembershipProvider) property in web.config to a MemberType already created in the admin-backend.
I didn't do anything different, but it has started working now. Maybe some caching issue or something, but "member.getProperty('zipcode').Value" works like a charm!
Creating member programatically
Hey,
I'm working on my event calendar, and got very nice help on approaching the calender structure itself.
I'm starting to implement the calendar, and I need members to be able to login on the website, to be able to register for an event.
I've searched the forum, and I still don't understand how I'll be able to set custom properties on the members I create. I've created my own usercontrol, for creating the members because I need the members to be able to upload an Image, supply a Zipcode etc. Can anyone point me in the right direction?
From what I could find on the forum, the following should work (simplified):
MembershipUser user = myProvider.CreateUser(eMail, password, eMail, string.Empty, string.Empty, true, string.Empty, out createStatus);
And then:
Member m = Member.GetMemberFromLoginName(user.UserName);
m.getProperty("Zipcode") = "9000";
or
ProfileBase profile = ProfileBase.Create(user.UserName);
profile.SetPropertyValue("Zipcode", "9000");
Either way, the member is created correctly, but I get the "Object not set to an instance..." error, when I set the property value.
Help? :-)
Formatting broke :/ I've tried to fix it without any luck - hope it's readable..
I think you need to set the defaultMemberTypeAlias(UmbracoMembershipProvider) property in web.config to a MemberType already created in the admin-backend.
//Magnus
I think I already did that, this is currently in my web.config:
Do I need to define anything else?
I didn't do anything different, but it has started working now. Maybe some caching issue or something, but "member.getProperty('zipcode').Value" works like a charm!
is working on a reply...