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...Building ExtensionsBuilding ExtensionsModulesModulesGetting custom profile field value in a moduleGetting custom profile field value in a module
Previous
 
Next
New Post
5/29/2011 5:07 PM
 

Hi,

I developed a module for my client that implements hours reporting by consultants. (DNN 5.3.1)

Now my client want to have a report that will show the consultants PersonalID (kind of Social Security number)

I added a custom profile field that holds the PersonalID but cannot figure out how to retrieve it in the module for the reports. (the UserID is NOT the current UserID but passed from Stored procedure that populate a grid)

I am sure there's a way to do it.

Any help will be appreciated.

Yehuda




Yehuda Tiram
AtarimTR
AtarimTR
972-2-5700114   |   972-54-4525492   |    http://www.atarimtr.co.il
 
New Post
5/29/2011 9:16 PM
 
The following function is similar to one that I used in my Content DeJour module:

Public Function GetPropertyValue(ByVal PropertyName As String, ByVal PortalID As Integer, ByVal UserID As Integer) As String
      Dim tmp As String = String.Empty
      Dim userInfo As DotNetNuke.Entities.Users.UserInfo
      userInfo = DotNetNuke.Entities.Users.UserController.GetUserById(PortalID, UserID)
      If userInfo IsNot Nothing AndAlso userInfo.UserID <> -1 Then
        Dim ppd As DotNetNuke.Entities.Profile.ProfilePropertyDefinition = userInfo.Profile.GetProperty("PersonalID")
        If ppd IsNot Nothing Then
          tmp = ppd.PropertyValue
          If tmp Is Nothing Then
            If Not String.IsNullOrEmpty(ppd.DefaultValue) Then
              tmp = ppd.DefaultValue
            End If
          End If
        End If
      End If
      Return tmp
End Function

Depending on your needs you may not need to handle anonymous users no return the property's default value in which case the code could be further simplified.

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
5/30/2011 4:44 AM
 
Thank you William, it works. I already saw you answer here: http://www.dotnetnuke.com/tabid/795/forumid/111/postid/303262/scope/posts/default.aspx
But it did not work for me. The one above did.
I use it as a call in a grid view like so:

And all is OK.

Thank you for your help.
Yehuda

Yehuda Tiram
AtarimTR
AtarimTR
972-2-5700114   |   972-54-4525492   |    http://www.atarimtr.co.il
 
New Post
5/30/2011 5:07 AM
 
The code did not show above. Here it is:



asp:Label ID="PRJ_CLNT_PersonalID" runat="server" Text='< %# GetPropertyValue("PersonalID", 0, (Eval("PRJ_CLNT_ID"))) % >'>

Yehuda Tiram
AtarimTR
AtarimTR
972-2-5700114   |   972-54-4525492   |    http://www.atarimtr.co.il
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesGetting custom profile field value in a moduleGetting custom profile field value in a module


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