Copied to clipboard

Flag this post as spam?

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


  • Michael Worrall 57 posts 82 karma points
    Jul 01, 2013 @ 11:53
    Michael Worrall
    0

    Members being duplicated when adding new ones

    Hi guys,

    I have a website which for some reason is duplicating the member when a new one is created. The member is being created by using the default .net Membership.CreateUser function. Both members have the exact same properties (login name, email etc…) but the member ID is different. If you then try to delete the member (through the Umbraco interface) with highest id it actually deletes the member with the 1st ID.

    This only seems to happen to some members – not all of them. The only thing which I believe could be the cause is that in the AfterSave event I’m checking to see if the member belongs to a particular group, if they do then I’m using a 3rd party API to subscribe them to a mailing list. Is it likely that if that API didn’t respond in a timely manner that Umbraco would create a new member?

    Has anyone ever experienced this before?

    Thanks, and any advice at this point will help me out!

    Mike

  • Michael Worrall 57 posts 82 karma points
    Jul 01, 2013 @ 12:08
    Michael Worrall
    0

    By the way I'm using v4.11.4

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jul 01, 2013 @ 12:12
    Jeroen Breuer
    0

    Hello,

    I haven't used the default .net Membership.CreateUser, but the Umbraco Member API is also much better for this. Even though it reports being obsolete it's actually not and the obsolete messages are even removed in newer versions again: https://github.com/umbraco/Umbraco-CMS/commit/7c6aee17e90d4b59a29cbcabf915475510c072c7

    So it might be better to try using the Umbraco Member API and see if it still happens than.

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jul 01, 2013 @ 12:33
    Jeroen Breuer
    0

    Here is a cheatsheet on how to use the Member API: http://our.umbraco.org/wiki/reference/api-cheatsheet/working-with-members

    Jeroen

  • Michael Worrall 57 posts 82 karma points
    Jul 01, 2013 @ 12:37
    Michael Worrall
    0

    Hi Jeroen,

    Thanks for that I'll give it ago using the Umbraco API and let you know if the problem persists. I deliberately reframed from doing this as they were marked as obsolete.

    Thanks,

    Mike

  • Michael Worrall 57 posts 82 karma points
    Jul 11, 2013 @ 10:44
    Michael Worrall
    0

    Ok,

    So I've changed the code to the Umbraco member API using Member.MakeNew, and it is still duplicating the member. It still happens at completley random intervals and I cannot replicate the error myself.

    I wonder if anyone has any idea as to why this is happening. In case I'm missing something obvious please see my code below.

    Thanks,

    Mike

    MemberType mt = MemberType.GetByAlias("Customer");
    User u = new User(0);
    Member umbMember = Member.MakeNew(Name.Text + ' ' + Surname.Text, email, email, mt, u);
    umbMember.Password = password;
    umbMember.getProperty("firstname").Value = Name.Text;
    umbMember.getProperty("surname").Value = Surname.Text;
    umbMember.getProperty("companyName").Value = Company.Text;
    umbMember.getProperty("telephoneNumber").Value = Telephone.Text;
    umbMember.getProperty("jobTitle").Value = JobTitle.Text;
    umbMember.getProperty("country").Value = Country.SelectedItem.Text;
    umbMember.Save();

     

  • Michael Worrall 57 posts 82 karma points
    Jul 11, 2013 @ 14:17
    Michael Worrall
    0

    Has noone else ever experienced this issue?

  • Michael Worrall 57 posts 82 karma points
    Jul 12, 2013 @ 11:38
    Michael Worrall
    0

    After a lot of playing around yesterday i discovered that the issue was not Umbraco duplicating the member, but the click event on the user control was being fired twice. It seems that it was just IE10 doing this when clicking on asp:button tags. I originally had my asp:buttons tags setup to render as:

    <button>
      <span>hello</span>
    </button>

    instead of the default <input /> element. Having chaged that back to an input element it resolves the issue.

    I hope that may be of some help in future to others....

Please Sign in or register to post replies

Write your reply to:

Draft