Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Working with User Profile PropertiesWorking with User Profile Properties
Previous
 
Next
New Post
4/30/2009 12:06 PM
 

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!

 
New Post
4/30/2009 1:09 PM
 

After adding or updating one or more profile properties, you will need to call

DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(oUser)

 

to persist the changes to the database.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
4/30/2009 1:43 PM
 

Thanks William.  That one line of code resolved the issue.  

With that said, I also wanted to make sure that this is the appropriate approach to take in order to do what I want to do based on my previous post.  Is there a better way?

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Working with User Profile PropertiesWorking with User Profile Properties


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out