Copied to clipboard

Flag this post as spam?

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


  • Gary Smith 27 posts 47 karma points
    Aug 09, 2010 @ 20:55
    Gary Smith
    0

    Membership properties, proper way to do it?

    I've seen a couple different posts on handling membership properties.  I need to add users to the system with several custom properties.  Using the CreateUserWizard is fine, as I can add the items I need there, but what's the current advised approach for adding these properies to the user?

    Many of the samples are using deprecated methods now.  Can someone post a quick couple liner on how to load a user, add properties and save them to the database using 4.5.1?  My intuition is to stay away from the deprecated stuff.

  • Halldór Hrafn Gíslason 30 posts 50 karma points
    Aug 10, 2010 @ 00:37
    Halldór Hrafn Gíslason
    0

    I'd like to second this question.

    I also prefare not to use depricated stuff, and avoid any work arounds (using depricaded stuff even).

    So, where are we with the membership support?

    Here is a nice article, but is it correct today?
    http://www.aaron-powell.com/umbraco-members-profiles

    Should we or shouldn't we be using Membership profiles?

    "The profile provider is not used and should be removed" -Niels Hartvig
    http://our.umbraco.org/forum/developers/extending-umbraco/2278-where-does-umbracoprofileprovider-store-data

    I may be new to Umbraco, but I'm really confused...

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Aug 10, 2010 @ 01:13
    Aaron Powell
    0

    I'm not sure why Niels said that as we've used the profile provider a few times without any major problems...

  • Gary Smith 27 posts 47 karma points
    Aug 10, 2010 @ 01:21
    Gary Smith
    0

    And there lies the question.  He has stated that it should go away, the membership methodology has changed from samples from a year ago, and there are now samples on how to do it now.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Aug 10, 2010 @ 01:27
    Aaron Powell
    0

    What I've got covered in the article on my website works as far as I'm aware.

  • Gary Smith 27 posts 47 karma points
    Aug 10, 2010 @ 05:41
    Gary Smith
    0

    I agree that the profile provider method that you have on the site is probably the best option BUT I'm just hesitant to implement it if it will soon be obsolete.  I'm working on a new set of functionality under 4.5.1.  With that I have read thus far, you're methods will probably work best.  I would still like confirmation from the umbraco people if they are looking to keep or dump the provider and what the best methods for handling additional properties are.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Aug 10, 2010 @ 08:02
    Aaron Powell
    1

    I will be fighting every step of the way if someone tries to remove it from the 4.5.x codebase ;)

  • Halldór Hrafn Gíslason 30 posts 50 karma points
    Aug 10, 2010 @ 09:55
    Halldór Hrafn Gíslason
    0

    Thank you Slace, now and for your previous work.

  • Halldór Hrafn Gíslason 30 posts 50 karma points
    Aug 10, 2010 @ 13:50
    Halldór Hrafn Gíslason
    0

    Hmm..

    Now that I'm trying to implement this thing, I'm getting a strange error.. or lack there of even..

    My setup: IIS 7.5 / Umb 4.5.1

    My web.config:

    <profile defaultProvider="UmbracoMemberProfileProvider" enabled="true" inherits="MyNamespace.MemberProfile">
    <providers>
    <clear />
    <add name="UmbracoMemberProfileProvider" type="umbraco.providers.members.UmbracoProfileProvider, umbraco.providers" />
    </providers>
    <!--
    <properties>
    <clear />
    <add name="firstName" allowAnonymous ="false" provider="UmbracoMemberProfileProvider" type="System.String" />
    <add name="lastName" allowAnonymous ="false" provider="UmbracoMemberProfileProvider" type="System.String" />
    </properties>
    -->
    </profile>

    Note that I have to remove the properties since IIS complains that firstName (and any other property I've defined in Umbraco) has allready been defined.

    On a webpage (profile page) I'm invoking this command on page load:

    FirstName.Text = ((MemberProfile)this.Context.Profile).FirstName;

    Which in turn invokes:

    [SettingsAllowAnonymous(false)]
    public string FirstName 
    {
      get
      {
        var o = base.GetPropertyValue("firstName");
        if (o == DBNull.Value)
        {
          return string.Empty;
        }
        return (string)o;
      }
      set
      {
        base.SetPropertyValue("firstName", value);
      }
    }

    This will however return an empty string, even though I've set data via umbraco membership section.

    What am I missing here?

    Do I need a tissue? :oP

  • Stief Dirckx 43 posts 76 karma points
    Feb 02, 2011 @ 21:01
    Stief Dirckx
    0

    I followed Aaron Powell's article but I'm not sure I'm doing it right.

    If I following his code I get the exception: "This profile property has already been defined." But when I change the property name in the inherited class (from ProfileBase) I see 2 properties while debugging: the property defined in the web.config and the property in my own class.

    Is this normal behavior of the UmbracoMemberProfileProvider?

  • GLindqvist 13 posts 13 karma points
    Feb 24, 2011 @ 12:50
    GLindqvist
    0

    Is it possible to create anonymous user via UmbracoMemberProfileProvider and Umbraco 4? 

Please Sign in or register to post replies

Write your reply to:

Draft