+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / Extending user properties..

Extending user properties..

11 posts, 0 answered
  1. Bobby Ross
    Bobby Ross avatar
    14 posts
    Registered:
    02 Nov 2004
    08 Oct 2010
    Link to this post
    Have the need to extend user properties/profiles for front end users.  For example adding a customer account number or other custom user properties that can be accessed at runtime to display custom pricing, etc inside of pages.  Is there a way to extend the built-in provider to store this additional information, or should I consider going with a custom provider?
    Are there any examples of this in 4.x basically showing how to add properties, and then gain access to them at runtime?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Oct 2010
    Link to this post
    Hello Bobby,

    You could get/set property values by using ProfileManager class

    ProfileManager profileManager = ProfileManager.GetManager();
    var profileUser = profileManager.CreateProfile(user);
    profileManager.SaveChanges();
     
    var prof = profileManager.GetProfiles().Where(p => p.User.UserName == "newUser1").SingleOrDefault();
    var getField = prof.GetValue("somefield");
    prof.SetValue("someField", "someValue");
    profileManager.SaveChanges();

    The profile provider is declared inside App_Data\Sitefinity\Configuration\SecurityConfig.config from where you can change its properties. Another option is using backend UI - Sitefinity/Administration/Settings/Security/Profile Providers

    Currently there is an issue with adding custom profile properties. I will update the status of the post  with more details once the issue has been resolved.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. John
    John avatar
    97 posts
    Registered:
    11 Jan 2011
    19 Jan 2011
    Link to this post
    Hi

    How does one add additional fiedls to the profile in the first palce?

    Many Thanks

    Regards
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Jan 2011
    Link to this post
    Hello John01,

    You can do this only programmatically as the code above shows.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Johar Iqbal
    Johar  Iqbal avatar
    10 posts
    Registered:
    20 Aug 2009
    23 Feb 2011
    Link to this post
    Hi,

    it gives design time error.

    'Telerik.Sitefinity.Security.Model.Profile' does not contain a definition for 'SetValue' and no extension method 'SetValue' accepting a first argument of type 'Telerik.Sitefinity.Security.Model.Profile' could be found (are you missing a using directive or an assembly reference?)

    Thanks
    Johar Iqbal

  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Feb 2011
    Link to this post
    Hello,

    Please check whether you have a reference to Telerik.Sitefinity.dll. Also you should have reference to Telerik.Sitefinity.Model.DataExtensions


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  7. Kevin
    Kevin avatar
    20 posts
    Registered:
    14 Jun 2010
    08 Mar 2011
    Link to this post
    Hello,

    I'm trying to add a custom properties to profiles and have started out based on information I found in this post, then found some additional information here which seems like it might be helpful but before I do any further debugging I'd like to know for sure if adding custom properties in this matter is actually supported at this time and that it won't cause any problems with any future releases.   It sounds here like profiles may not be fully implemented yet.   If it just comes down with not having a UI at this time I'm ok with doing everything I need programmatically, just don't want to duplicate my efforts down the line.

    Thanks!
  8. Lyubomir Dokov
    Lyubomir Dokov avatar
    43 posts
    Registered:
    01 Nov 2016
    14 Mar 2011
    Link to this post

    Hello,

    User profiles will be changed for Q1 release and we will provide advanced options for profile management.  I would recommend you to wait for it, if your deadlines allow it, because  The code that Ivan Dimitrov posted in a previous post should work, but might cause problems after upgrade to Q1 release, since we changed the API.


    Greetings,
    Lyubomir Dokov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  9. mattshepherd
    mattshepherd avatar
    5 posts
    Registered:
    25 Mar 2007
    20 Apr 2011
    Link to this post
    Could you provide some details around this post release of Q1.  I have created custom profile types in the UI but wondering how to access these properties from within the SDK.

    Cheers,
    Matt
  10. Peter Kinmond
    Peter Kinmond avatar
    11 posts
    Registered:
    22 Dec 2010
    21 Apr 2011
    Link to this post
    Seconded. Trying to do the same thing as Matt.
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    25 Apr 2011
    Link to this post
    Hi ,

    You need to use SitefinityProfile object

    http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/retrieving-custom-profile-fields.aspx

    http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/how-to-set-avatar-in-user-profile.aspx

    Profiles API has been changed with Sitefinity 4.1( Q1) release.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

11 posts, 0 answered