Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ricky Beard 61 posts 116 karma points
    Dec 04, 2009 @ 18:05
    Ricky Beard
    0

    Change member type programatically

    I have a scenario where I need to be able to create members of several different member types. I am currently using the CreateUserWizard control and am attempting to change the member type in the CreatedUser event, but I am having no luck. The following code snippet does nothing (no update, no read-only error for ContentType).

    Member m = Member.GetMemberFromLoginName(CreateUserWizard1.UserName);
    m.ContentType = ContentType.GetByAlias("MemberTypeAlias");
    m.Save();

    I know I can scrap the CreateUserWizard and roll my own control using Member.MakeNew, but I was just wondering if it were possible to get this done using the wizard.

  • Ricky Beard 61 posts 116 karma points
    Dec 04, 2009 @ 18:20
    Ricky Beard
    0

    I found one workaround.

    I added another membership provider entry (copied UmbracoMemberShipProvider) in the web.config file and only changed the defaultMemberTypeAlias. Then, I was able to change the CreateUserWizard's MembershipProvider property to my new provider in the CreatingUser event.

    Does anyone have a better solution?

Please Sign in or register to post replies

Write your reply to:

Draft