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
Need to add custom properties to a member and populate them via code.
How can you do this in v9?
Well the properties are set in the backoffice (just like documenttypes), but in code you can do this.
You first need to get the alias of the field, if you're using modelsbuilder you can do it like this:
var customMemberProperty = Member.GetModelPropertyType(_publishedSnapshotAccessor, x => x.CustomMemberProperty).Alias;
or just use the string alias of the field, in this case "customMemberProperty".
Then get the member by various means (email or id for example)
var memberToUpdate = _memberService.GetByEmail(emailAddress);
Then update the values:
memberToUpdate.SetValue(customMemberProperty, "NewValue");
And save them
_memberService.Save(memberToUpdate);
Done!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How do you add member property value to a member in v9
Need to add custom properties to a member and populate them via code.
How can you do this in v9?
Well the properties are set in the backoffice (just like documenttypes), but in code you can do this.
You first need to get the alias of the field, if you're using modelsbuilder you can do it like this:
or just use the string alias of the field, in this case "customMemberProperty".
Then get the member by various means (email or id for example)
Then update the values:
And save them
Done!
is working on a reply...