Copied to clipboard

Flag this post as spam?

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


  • Rob Watkins 369 posts 701 karma points
    Feb 25, 2011 @ 17:23
    Rob Watkins
    0

    Custom member properties in 4.5+

    I'm finding information about member profiles incredibly hard to collate into an understandable whole.

    I have a site with a single member type, which has a couple of custom properties on it. Login and everything all works perfectly using the .NET controls. I can even view all the member properties easily from XSLT using the GetMember() function.

    Now I want to create a page for members to edit their own  profile, including the custom properties.

    Everything I look at seems to have a different way of doing this! Surely it must be an incredibly common scenario?!

    Can anyone point me to some definitive instructions on how to do this in Umbraco 4.5+? I'm willing to put something together myself but I actually don't even know where to start!

    Lots of the suggestions seem to be that you have to add the properties into the web.config as well as in the admin system - surely that can't be required?

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Feb 28, 2011 @ 00:36
    Bo Damgaard Mortensen
    0

    Hi Rob,

    I did this in a project I made a while ago, please let me dig up the code for you..

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Feb 28, 2011 @ 00:54
    Bo Damgaard Mortensen
    1

    Alright, here we are - don't know if this is what you meant, but I'll give it ago:

    I did it like this:

       Member m = Member.GetCurrentMember();
            m.getProperty("adresse").Value = txtAddress.Text;
            m.getProperty("by").Value = txtCity.Text;
            m.Email = txtEmail.Text; 
            m.getProperty("telefonNummer").Value = txtPhone.Text;
            m.Save();
    
    Quite simple - the only flaw about this is that it doesn't use the ASP.NET Membership model..

     

  • Rob Watkins 369 posts 701 karma points
    Feb 28, 2011 @ 10:21
    Rob Watkins
    0

    Okay, cool, I'll give that a bash now - looks like I would have expected to look - i.e. simple :o) Thanks! 

    I don't really care about using the ASP.NET membership model if this way is also legit as I will just be using the built-in Umbraco provider - what I don't want to do is to be using a method that is actually deprecated in 4.5 though - so if anyone can chip in with an "approved" method that would be good!

  • Rob Watkins 369 posts 701 karma points
    Feb 28, 2011 @ 11:08
    Rob Watkins
    0

    P.S. Do you have any example code for changing the name / email / password - i.e. the standard properties?

    EDIT: Just noticed that you posted that. D'oh!

  • Michael Latouche 504 posts 819 karma points MVP 4x c-trib
    Feb 28, 2011 @ 11:32
    Michael Latouche
    0

    Hi Rob,

    For the "non-deprecated/approved" version, I think you have to use member profiles to solve this. There is an article written by Aaron Powell that explains this very well:

    www.aaron-powell.com/umbraco-members-profiles

    Hope this helps.

    Cheers,

    Michael.

  • Rob Watkins 369 posts 701 karma points
    Feb 28, 2011 @ 12:15
    Rob Watkins
    0

    Hi Mike, that is a great page; it looks like the ASP.NET membership provider is a real pain in the arse though. Umbraco makes it so easy to add member properties as and when you  / the client might need them that having to have a compiled class for your member AND also having to add the aliases into the web.config seems like a real backwards step. 

    I can see why it would be the way to go if you had a complex custom provider scenario integrating into outside systems, but just using the Umbraco API seems to be by far the best solution for a simple Umbraco site with all the members managed entirely within the CMS.

  • Michael Latouche 504 posts 819 karma points MVP 4x c-trib
    Feb 28, 2011 @ 12:24
    Michael Latouche
    0

    Hi Rob,

    In agree with you. I actually haven't felt the need to use the profile stuff yet and prefer "the more simple way" also :-)

    Cheers,

    Michael.

  • Rob Watkins 369 posts 701 karma points
    Feb 28, 2011 @ 13:16
    Rob Watkins
    0

    Well, I've got it all working now! I'm going to mark Mike's response as the answer as that most closely matched my actual question; however, I'm going to go with the technique Bo posted.

Please Sign in or register to post replies

Write your reply to:

Draft