Copied to clipboard

Flag this post as spam?

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


  • Barry Fogarty 493 posts 1129 karma points
    Aug 12, 2011 @ 18:28
    Barry Fogarty
    0

    Change member name

    Is there a way to change a member name (text) via the usitebuilder MemberTypeBase?  I know I can do somehting like

    umbraco.cms.businesslogic.member.Text = 'new member name'

    but it would be nice not to have to instatiate the umbraco member class if I don't need to.

  • Barry Fogarty 493 posts 1129 karma points
    Aug 18, 2011 @ 12:25
    Barry Fogarty
    0

    Any update on this, or should I just use the Umbraco API directly to accomplish this requirement?

  • Vladan Ostojic 94 posts 210 karma points
    Aug 27, 2011 @ 08:11
    Vladan Ostojic
    0

    Yes, sure it is possible as following:

    myMember.LoginName = "newname";

    myMember.Save(); (from version 1.2) or MemberHelper.Save(myMember);

  • Barry Fogarty 493 posts 1129 karma points
    Sep 03, 2011 @ 10:30
    Barry Fogarty
    0

    Hi Vladan thanks for posting but I am looking to change the 'Name' property of the member, not the LoginName (username).  Is there a way to change this property.  I cannot find any reference to change member name.

  • Vladan Ostojic 94 posts 210 karma points
    Sep 06, 2011 @ 14:52
    Vladan Ostojic
    0

    Hm, I see now. Using uSiteBuilder is not possible to accomplish this. You can probably use Umbraco Member API for this.

  • Razvan 36 posts 67 karma points
    Jul 11, 2012 @ 15:58
    Razvan
    0

    Hi,

    I'm also looking for this functionalty. To be able to change the "display name".

     

  • Barry Fogarty 493 posts 1129 karma points
    Jul 11, 2012 @ 16:09
    Barry Fogarty
    0

    Hi Razvan,

    uSiteBuilder does not support this but I used the following:

    Member umbMember = Member.GetCurrentMember();
    umbMember.Text = firstname + " " + lastname;
    umbMember.Save();

    Member is of type umbraco.cms.businesslogic.member.

  • Razvan 36 posts 67 karma points
    Jul 11, 2012 @ 16:16
    Razvan
    0

    Hi Barry,

    Thanks for the info. I ended up umbraco events to change the member name to the desired format.

     

     

    public class Events : ApplicationBase
    {
        public Events()
            {
                umbraco.cms.businesslogic.member.Member.AfterSave += new umbraco.cms.businesslogic.member.Member.SaveEventHandler(Member_AfterSave);            
        }
    
        void Member_AfterSave(umbraco.cms.businesslogic.member.Member sender, umbraco.cms.businesslogic.SaveEventArgs e)
        {
            var name = member.getProperty("name").Value.ToString();            
                if(Core.Helper.EmailIsValid(member.Text) && !string.IsNullOrEmpty(name))
                {
                    member.Text = name;
                    member.Save();
                }
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft