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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Richard Edwards article on DNNStuff.com : Where is it stored: aspnet_Profile table ... for DNN 3.3Richard Edwards article on DNNStuff.com : Where is it stored: aspnet_Profile table ... for DNN 3.3
Previous
 
Next
New Post
7/6/2006 2:53 PM
 

First, I just wanted to say THANK YOU! to all of the core team members who worked on returning the User Profile storage back into a human & more easily machine readable form !!! The pre-3.3 provider was a nightmare.

While developing a custom module last year, I had the requirement to develop a search-able list of DNN users, and happened across the excellent article by Richard Edwards on DNNStuff.com : "Where is it stored: aspnet_Profile table ." which described in detail how to write to SQL Functions to return the value of a given profile property. Using these functions, it was a snap to write another view which passed in named properties, ultimately allowing a query-able view of extended profile properties such as Address, City, State, etc.

My question is, has anybody written a similar SQL View for the much better and much improved DNN 3.3 membership structure? Just curious, I suppose I could adapt my older procedure to work with the new format without to much sweat.

Again, thank you to everyone who contribute your time to making DotNetNuke some of the most satisfying software I get to work with, you rock!

 
New Post
7/6/2006 6:30 PM
 

It's actually pretty easy now. You just need to do an INNER JOIN between ProfilePropertyDefinition and UserProfile. I threw together a quick little dnn4 module that shows how to select a list of profile properties, and then retrieve a sorted list of their related values with a count of how often they occur. You can download it (source included) @ http://www.cathal.co.uk/Default.aspx?tabid=86

Cathal


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
7/6/2006 6:50 PM
 

I ended up doing something similar to the solution I referenced:

Listing 1:

CREATE  FUNCTION dbo.GetUsersProfilePropertyByName

       (

       @UserID                                  int,

       @PortalID                         int,

       @PropertyName              nvarchar(50)

       )

RETURNS nvarchar(50)

AS

       BEGIN

       DECLARE @DefinitionID int

       SET @DefinitionID = (dbo.GetProfilePropertyDefinitionID(@PortalID, @PropertyName))

       Declare @Value nvarchar(50)

       Select @Value = (

              Select Top 1 PropertyValue

              FROM dbo.UserProfile

              WHERE UserID = @UserID

              AND PropertyDefinitionID = @DefinitionID

              )

             

       RETURN ISNULL(@Value, '')

       END

Listing 2:

Create  VIEW dbo.vw_Users_AF_Membership

AS

SELECT     U.UserID, U.Username, dbo.GetUsersProfilePropertyByName(U.UserID, UP.PortalId, N'FirstName') AS FirstName,

                      dbo.GetUsersProfilePropertyByName(U.UserID, UP.PortalId, N'LastName') AS LastName, UP.PortalId, '' AS Location,

                      dbo.GetUsersProfilePropertyByName(U.UserID, UP.PortalId, N'WebSite') AS WebSite, 0 AS Posts, 0 AS UserDetailsID,

                      dbo.GetUsersProfilePropertyByName(U.UserID, UP.PortalId, N'City') AS City, dbo.GetUsersProfilePropertyByName(U.UserID, UP.PortalId, N'Region')

                      AS Region, dbo.GetUsersProfilePropertyByName(U.UserID, UP.PortalId, N'Country') AS Country, UP.PortalId AS ApplicationName, GETDATE()

                      AS LastActivityDate, GETDATE() AS CreateDate

FROM         dbo.Users U INNER JOIN

                      dbo.UserPortals UP ON U.UserID = UP.UserId

WHERE     (UP.PortalId = 0)

 

Which is then a 1 to 1 field matching with a users table I needed to populate in Active Forums earlier version module:

INSERT INTO dbo].[AF_Membership]

([UserID], [Username], [FirstName], [LastName], [PortalId], [Location], [WebSite], [Posts], [UserDetailsID], [City], [Region], [Country], [ApplicationName], [LastActivityDate], [CreateDate])

Select [UserID], [Username], [FirstName], [LastName], [PortalId],

[Location], [WebSite], [Posts], [UserDetailsID], City,  Region,Country, [ApplicationName], [LastActivityDate], [CreateDate] FROM vw_Users_AF_Membership

WHERE UserID Not In (Select UserID FROM AF_Membership)

Keep in mind anyone wanting to use this solution, the view I created filters for portal id of 0. Otherwise, it should be pretty easy to modify this for other uses.

 
New Post
7/7/2006 12:33 PM
 

Kennster,

Can you share the sql or module ?  I have needed to get this data in the past and like you said it has been a nitemare which I lack the programming skills to overcome.

Thanks.

 
New Post
7/7/2006 1:44 PM
 
Succorso wrote

Kennster,

Can you share the sql or module ?  I have needed to get this data in the past and like you said it has been a nitemare which I lack the programming skills to overcome.

Thanks.

My posted solution should really suffice: I even took the time to nicely format the SQL: Copying and pasting the SQL from Query Analyzer into Visual Studio, then copying and pasting the resultant color coded SQL into Office Word 2003, then pasting that into the window, and when I look at the final posted form, it still looks nicely color coded (thanks forum admin for enabling this functionality btw as it significantly enhances the ever important ability to exchange information).

That being said, you should be able to copy and paste the Create Function statement from my earlier post into query analyzer to create the function, then modify the view to match your own needs, all the pieces parts are there. If the SQL Server is accessible, I would be happy to do it for you for a modest donation to my paypal account.

-Kenneth S. Courtney

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Richard Edwards article on DNNStuff.com : Where is it stored: aspnet_Profile table ... for DNN 3.3Richard Edwards article on DNNStuff.com : Where is it stored: aspnet_Profile table ... for DNN 3.3


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