When you have a custom member type defined in Umbraco with some extra properties (eg. a property named customMemberInformation), the following code can be used (for example in your own SurfaceController):
...
MembershipCreateStatus status;
var member = Members.RegisterMember(model, out status, model.LoginOnSuccess);
// Handle custom fields
var memberService = Services.MemberService;
var customMember = memberService.GetByEmail(member.Email);
customMember.SetValue("customMemberInformation", "My custom member information");
memberService.Save(customMember);
...
In this simplified example I store the text "My custom member information" in the custom field and save the data using the MemberService.
Add custom property to Membership member
Hi
I need to programmatically add a custom property an umbraco member using the standard membership provider. I'm using Umbraco 7.3.
So I create the member below (is this correct?) then I need to add a custom property that will store simply a list of integers.
What approach do I take?
Hi Euge,
Try to see our documentation about the member service, there you have the create method and others.
https://our.umbraco.org/documentation/reference/management/services/memberservice
Or in this video on Umbraco TV
https://umbraco.tv/videos/umbraco-v7/developer/fundamentals/member-api/
Hope this helps,
/Dennis
Great thanks Dennis
There doesn't appear to be anything on adding a custom property but I am thinking along the lines of
Hi Euge,
This video should show you have to set custom property values on a member using the Member API
http://umbraco.tv/videos/umbraco-v7/developer/fundamentals/member-api/populating-property-values/
Hope this helps,
/Dennis
Hi Euge,
When you have a custom member type defined in Umbraco with some extra properties (eg. a property named customMemberInformation), the following code can be used (for example in your own SurfaceController):
...
...
In this simplified example I store the text "My custom member information" in the custom field and save the data using the MemberService.
Does this help you move ahead?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.