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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom Profile PropertiesCustom Profile Properties
Previous
 
Next
New Post
8/5/2006 9:22 AM
 
Thanks guys!

You both helped me a lot - actually I had some troubles with grabbing the "right" ProfilePropertiesCollection.
I was just hoping to get it from the User class from the base class (portalmodulebase) but that just seems to be empty in terms of values.
The thing is though that the PorperyNames are there only the values are missing. So the solution was to use the GetCurrentUserInfo() method in the UserController class. Thanks for that hint!
I realized that (as you have mentioned apk2006) it will cause a module exception if I try to get the Properties of an anoymous (aka not logged in) user. So I decided to check the UserID and that kinda works like expected. My only problem now seems to be caching related because once I have been on my page with the module on it the displayed info will not change even if I log in or log out then. So only the first visit will set the data and then it will just be the same.
As said, I am assuming that this behavious is caching related so if anyone has some clues - go ahead

So here is my code to those of you who are interested:

             string result = "";
            ProfilePropertyDefinitionCollection m_objProperties;
            DotNetNuke.Entities.Users.UserInfo curUser = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();
            if (curUser.UserID >=0)
            {
                m_objProperties = curUser.Profile.ProfileProperties;
                result = m_objProperties.GetByName("myCustomProperty").PropertyValue;
            }
          

            return result;
 
New Post
8/6/2006 12:41 PM
 
I have changed the cache-time in module-settings from the default value of 60 to 0 and now it works!

Cheers,

Tillman
 
New Post
8/7/2006 8:58 AM
 
I also found another solution for this and I would like to add in here as well, in case someone is interested

If Requrest.IsAuthenticated then
    'get the customize profile property
 
New Post
8/7/2006 5:28 PM
 
One more tip for who it may apply,  once you have the CurrentUserInfo you can get the value of a specific profile property by using the GetPropertyValue method.

objUser.Profile.GetPropertyValue("profilepropertyname")

This also works with any custom profile properties that have been created.

Although there is also a SetProfileProperty (see below), I can't seem to write any strings back to the UserProfile tables using it.

Public Sub SetProfileProperty(ByVal propName As String, ByVal propValue As String)
Member of: DotNetNuke
.Entities.Users.UserProfile

 
New Post
8/7/2006 6:03 PM
 

As far as the SetPropertyValue method, I just forgot to update the UserController to write the changes to the tables.  So it would be something like this:

Dim objUser As UserInfo = UserController.GetCurrentUserInfo()
objUser.Profile.SetProfileProperty(
"propertyname", "propertyvalue")
UserController.UpdateUser(PortalSettings.PortalId, objUser)

 This also works with any custom profile properties that have been created.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom Profile PropertiesCustom 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