Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I have found a piece of code to programmatically create new members. This seems ok but how do I set my custom properties of the member?
Code to add a new member:
IMember member = ApplicationContext.Services.MemberService.CreateMember("autodest", "[email protected]", "p00005 - Autoparts Destelbergen ( FILIAAL )", "member"); member.IsApproved = true; try { ApplicationContext.Services.MemberService.Save(member); ApplicationContext.Services.MemberService.SavePassword(member, "prosec"); ApplicationContext.Services.MemberService.AssignRole(member.Id, "Prosec Online"); } catch { }
For example I have the following custom properties:
/Michael
Ok, I have found the solution.
For anyone that was looking for this, below is the solution:
if (member.HasProperty("branch")) member.SetValue("branch", 1079);
var memberService = ApplicationContext.Current.Services.MemberService; var member = memberService.GetById(member.Id); member.SetValue("customPropertyAlias", "customValue"); memberService.Save(member);
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Add new member and set custom made member properties
Hi,
I have found a piece of code to programmatically create new members. This seems ok but how do I set my custom properties of the member?
Code to add a new member:
For example I have the following custom properties:
/Michael
Ok, I have found the solution.
For anyone that was looking for this, below is the solution:
/Michael
is working on a reply...