Copied to clipboard

Flag this post as spam?

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


  • Matt Bliss 176 posts 234 karma points c-trib
    Feb 03, 2012 @ 14:19
    Matt Bliss
    0

    Changing the displayed member name in C# code.

    I'm creating members in my C# code (Umbraco 4.7.1) using the System.Web.Security.Membership and System.Web.Security.MembershipUser classes and a 'MemberProfile' class derived from System.Web.Profile.ProfileBase. For some time now has been the correct way to handle members in Umbraco.

    However I am using a 3 lines of code which revert back to the old and now marked as obsolete umbraco.cms.businesslogic.member.Member class as I cannot find any method of changing the member name displayed in the Umbraco backend using the profile provider (the displayed name defaults to the user name). My 'obsolete' three lines of code are:

    Member member = Member.GetMemberFromEmail(email);
    member.Text = newUserName;
    member.Save();

    They work though and have the desired effect, so it is not a problem as such that I am posting, but I can't help wondering if I am missing another way of handling this?

    I'd be interested to hear comments.

  • Benjamin Wyatt 3 posts 23 karma points
    Mar 05, 2012 @ 13:10
    Benjamin Wyatt
    0

    Hi Matthew

    Did you find a way around using this obsolete method? I need to do exactly the same thing - set the 'Name' field in Umbraco to something other than their login name (which will be the email address).

    There's a similar thread here: http://our.umbraco.org/forum/developers/api-questions/21392-Accessing-member-name

    Thanks

    Ben

  • Matt Bliss 176 posts 234 karma points c-trib
    Mar 05, 2012 @ 13:38
    Matt Bliss
    0

    Hi Benjamin,

    I've not found an alternative. The above code works (I just get a green underline in the source) so I've left it and moved on!

    Thanks

    Matt.

Please Sign in or register to post replies

Write your reply to:

Draft