Copied to clipboard

Flag this post as spam?

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


  • SlothMonkey 17 posts 56 karma points
    Jan 15, 2015 @ 15:25
    SlothMonkey
    0

    Dynamically Creating a New user & auto sign in

    I'm trying to create a new forum member at the same time I create a new umbraco member and have the ability for them to auto sign into their forum account when the log into their umbraco account. 

     

    however, I'm having some really issues trying to dynamically create a forum member.

     

    For an umbraco member I'm doing the following

     

        Member newMember;

        MemberType demoMemberType = MemberType.GetByAlias("Member");

     

        private void SomeMethod(ModelClass newEmployee)

        {

            if (!memberSevice.Exists(newEmployee.FirstName + newEmployee.LastName))

            {

             newMember = Member.MakeNew(newEmployee.FirstName  + newEmployee.LastName , demoMemberType, new umbraco.BusinessLogic.User(0));

            }

            else if (memberSevice.Exists(newEmployee.FirstName + newEmployee.LastName))

            {

              int count = 0;

              count = count + memberSevice.Count();

              newMember = Member.MakeNew(newEmployee.FirstName + newEmployee.LastName + count, demoMemberType, new umbraco.BusinessLogic.User(0));

             }

              newMember.getProperty("firstName").Value = newEmployee.FirstName;

              newMember.Save();

        }

     

    But when I tried doing the same but changing the Alias to both DialogueMember & Dialogue Member the new forum member isn't created. I know how to edit existing forum members by grabbing their ID number (which I need to hardcode) and i'm able to log in when my user logs in (but again, these are hardcoded in).

     

    I've got a feeling that this isn't working due not being able to generate a unique user ID for Dialogue Members and I was wondering if someone could tell me what it is I'm doing wrong and how I can fix it

Please Sign in or register to post replies

Write your reply to:

Draft