Using Umbraco 6.0.5 I am trying to save some custom member properties via the API. The new member is created fine but the custom properties are not saved. I have checked that the properties exist. In fact if the property name is changed to one that does not exist an error is thrown:
publicoverridevoid Submit() { //get a membertype by its alias var mt = MemberType.GetByAlias(MemberTypeAlias); //needs to be an existing membertype //get the user(0) var user = newUser(0); //create a new member with Member.MakeNew var member = Member.MakeNew(Name, mt, user); //assign email, password and loginname member.Email = Email; member.Password = Password; member.LoginName = Email; //asign custom properties member.getProperty("committee").Value = Committee; member.getProperty("organisation").Value = Organisation;
//asssign a group, get the group by name, and assign its Id var group = MemberGroup.GetByName(MemberGroupName); //needs to be an existing MemberGroup member.AddGroup(group.Id); //generate the member xml with .XmlGenerate member.XmlGenerate(new System.Xml.XmlDocument()); //add the member to the website cache to log the member in Member.AddMemberToCache(member); }
Saving custom member properties via API
Using Umbraco 6.0.5 I am trying to save some custom member properties via the API. The new member is created fine but the custom properties are not saved. I have checked that the properties exist. In fact if the property name is changed to one that does not exist an error is thrown:
you need to call
for older version that was not mandatory but for umbraco 6 and above you have to call save method in order to save the properties.
http://charlesafford.com/umbraco-membership-provider.aspx Have a look at this :)
You also need to make sure the Name and Alias are diffrent :).
is working on a reply...