Thursday, September 09, 2010

Contact Us!

AppTheory wants to talk to you about your business requirements.

Click Contact to fill out an online requirements questionnaire.

Thanks!

DNN Gold Partner


 

Ecommerce Award

Subscribe to this Blog

DotNetNuke Blogs

Current Articles | Archives | Search |

Extracting DotNetNuke User Information With SQL

It is not uncommon to have a client request a list of site users in a particular role. You can obviously get this information from the DotNetNuke user interface but its very easy to get this directly from the tables in SQL Management Studio and then export to a CSV or Excel file for easy distribution. Below is an example of finding all users for a particular portal.

SELECT      Users.UserID, Users.Username, Users.FirstName, Users.LastName, Users.Email, Users.DisplayName, UserPortals.PortalId
FROM         Portals INNER JOIN
                      UserPortals ON Portals.PortalID = UserPortals.PortalId INNER JOIN
                      Users ON UserPortals.UserId = Users.UserID
WHERE     (UserPortals.PortalId = 2)

Likewise, it is also very easy to get a list of users in a particular role. The SQL to get this list would look something like this

SELECT      Users.UserID, Users.Username, Users.FirstName, Users.LastName, Users.Email, Users.DisplayName, UserRoles.RoleID
FROM         Users INNER JOIN
                      UserRoles ON Users.UserID = UserRoles.UserID INNER JOIN
                      Roles ON UserRoles.RoleID = Roles.RoleID
WHERE     (UserRoles.RoleID = 12)

One great thing about having all of this information inside the database is that it make the information very easy to query.


Posted in: DotNetNuke Tips & Tricks, DotNetNuke Misc, General on Wednesday, November 11, 2009 12:29 PM by Scott Schecter

COMMENTS

bee
# bee
Wednesday, November 18, 2009 8:10 PM
nice tips...

i have problem with user statictics in my dnn portal...
can i get information about who is "come" day by day ..?
what is tables name that i can get statistic user ?

thx u 4 ur help ...




Only registered users may post comments.
Copyright © 2010 AppTheory