I have a requirement to tie our we user taxonomy system with something similar in DNN. By user taxonomy, I mean things such as defining and specifying values for additional user attributes other than what's contained in the physical users table in SQL Server - things like their interests, email opt-in/opt-out options, etc. I noticed that DNN has tables like Profile Property Definition and User Profile that can be utilized for this purpose. I also found that there is support in the underlying object model to work with these tables (classes such as ProfilePropertyDefinition, ProfilePropertyAccess, etc).
I tried to define a new property for a user in my code, but even though it did add the property to the user profile at the object level, it didn't seem to create that property in the User Profile Table. Here's my code ... could I be doing something wrong here?
Dim ppd As DotNetNuke.Entities.Profile.ProfilePropertyDefinition
Dim oPropertyAccess As DotNetNuke.Entities.Users.ProfilePropertyAccess
Dim oUser As UserInfo
oUser = UserController.GetUserByName(0, "user1")
oPropertyAccess = New DotNetNuke.Entities.Users.ProfilePropertyAccess(oUser)
ppd = New DotNetNuke.Entities.Profile.ProfilePropertyDefinition
ppd.PropertyName = "My Property"
ppd.PropertyValue = "My Value 1"
ppd.PropertyCategory = "APTIFY"
oUser.Profile.ProfileProperties.Add(ppd)
Return oPropertyAccess.GetProperty("My Property", "", Nothing, oUser, DotNetNuke.Services.Tokens.Scope.NoSettings, Nothing).ToString
The last "Return" statement does return "My Vaue 1", which is the correct value opf the custom property, but the property definition does not seem to be created at the database level. Any advice would be appreciated. Thanks!