Extending user properties.. - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Extending user properties..

  • Extending user properties..
  • 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?
  • 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.
  • Hi

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

    Many Thanks

    Regards
  • 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.
  • 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

  • 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!
  • 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!
  • 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!
  • 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
  • Seconded. Trying to do the same thing as Matt.
  • 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 >>