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
Trying to create members in a Partial View, but something isn't right
With the code below, i get the following error
CS1501: No overload for method 'RegisterMember' takes 1 arguments
Reference documentation: http://our.umbraco.org/Documentation/Reference/Querying/MemberShipHelper/ ;
Umbraco v. 7.1.4
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using Umbraco.Core; @using Umbraco.Core.Models; @using Umbraco.Core.Services; @{ var message = ""; if(IsPost){ if (Members.GetByEmail(Request.Form["customerEmail"]) == null){ var memberModel = Members.CreateRegistrationModel(); memberModel.Name = Request.Form["customerName"]; memberModel.Email = Request.Form["customerEmail"]; memberModel.Password = Request.Form["customerPassword"]; Members.RegisterMember(memberModel); } else { message = "User exists"; } } }
Solved it with MemberService
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ var message = ""; var MemberService = ApplicationContext.Current.Services.MemberService; if(IsPost){ if (Members.GetByEmail(Request.Form["customerEmail"]) == null){ var newMember = MemberService.CreateMember(Request.Form["customerUsername"],Request.Form["customerEmail"],Request.Form["customerName"],"MemberType"); newMember.SetValue("customProperty", Request.Form["customerPropertyValue"]); newMember.IsApproved = true; MemberService.Save(newMember); MemberService.SavePassword(newMember,Request.Form["customerPassword"]); } else { message = "User exists"; } } }
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.
Continue discussion
Members.RegisterMember; No overload for method takes 1 arguments
Trying to create members in a Partial View, but something isn't right
With the code below, i get the following error
CS1501: No overload for method 'RegisterMember' takes 1 arguments
Reference documentation: http://our.umbraco.org/Documentation/Reference/Querying/MemberShipHelper/ ;
Umbraco v. 7.1.4
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using Umbraco.Core; @using Umbraco.Core.Models; @using Umbraco.Core.Services; @{ var message = ""; if(IsPost){ if (Members.GetByEmail(Request.Form["customerEmail"]) == null){ var memberModel = Members.CreateRegistrationModel(); memberModel.Name = Request.Form["customerName"]; memberModel.Email = Request.Form["customerEmail"]; memberModel.Password = Request.Form["customerPassword"]; Members.RegisterMember(memberModel); } else { message = "User exists"; } } }Solved it with MemberService
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ var message = ""; var MemberService = ApplicationContext.Current.Services.MemberService; if(IsPost){ if (Members.GetByEmail(Request.Form["customerEmail"]) == null){ var newMember = MemberService.CreateMember(Request.Form["customerUsername"],Request.Form["customerEmail"],Request.Form["customerName"],"MemberType");newMember.SetValue("customProperty", Request.Form["customerPropertyValue"]);
newMember.IsApproved = true; MemberService.Save(newMember); MemberService.SavePassword(newMember,Request.Form["customerPassword"]);
} else { message = "User exists";
} } }
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.