Click Contact to fill out an online requirements questionnaire.
Thanks!
Current Articles | Archives | Search |
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.