Copied to clipboard

Flag this post as spam?

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


  • Matt Taylor 873 posts 2086 karma points
    Mar 27, 2012 @ 17:52
    Matt Taylor
    0

    Changing a member's username

    I see that it is possible to change a member's username in the back-end.

    My client wants to use email addresses as usernames, therefore if a member changes their email address on the website I need to run a bit of code to change their username too.

    Does anyone know how I can hook into the provider code that's used in the back-end to do this?
    I'm imagining that would be the simplest thing to do?

    Regards,

    Matt

  • Scott Hugh Alexandar Petersen 349 posts 164 karma points
    Jun 15, 2012 @ 15:47
    Scott Hugh Alexandar Petersen
    0

    Where do you want to change it, from code or from backend?

  • Matt Taylor 873 posts 2086 karma points
    Jun 18, 2012 @ 09:51
    Matt Taylor
    0

    Hi Scott,

    Sorry for the delay in getting back to you. I was at CG12 and wanted to check my solution back in the office before replying.

    I found it was quite easy to change the username using the 'original' Membership API.

    umbraco.cms.businesslogic.member.Member uMember = umbraco.cms.businesslogic.member.Member.GetMemberFromLoginName(currentUsername);
    uMember.LoginName = newUsername;
    uMember.Save();

    Regards,

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft