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();
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
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
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.
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