Despite the fact that DNN is an open-sourced software where the community is encouraged to contribute to its betterment, I was not able to find a method within the UI of DNN version 7.3.2 to generate a list of active users and export it to an Excel spreadsheet for our product owners.
I could already hear people telling me that I can just go under Admin > Users and this will show me a list of active users, and they are indeed correct. There’s just one problem: I’m unable to print these list of users.
I opted to write a SQL query, one that anyone can take if you’re running version 7.3.2, and simply replace your database and portal specifics as you desire. I know there are various renditions of this floating throughout the web, but this one is special in the fact that it specifically obtains active users for that portal – that’s it. No extra frills or thrills. If you want to add any additional columns from the database onto your SQL, please do, but please use this as a starting point only and not a means to an end (for every solution that is).
/* This script obtains a list of active users for a specified DNN Portal */ /* Replace the 'PortalId' to reference the portal/website that you are looking up */ SELECT Users.UserId, Users.Username, Users.DisplayName, UserPortals.PortalId FROM Users INNER JOIN UserPortals ON UserPortals.UserId=Users.UserId WHERE PortalId='[[ENTER PORTALID HERE]]' AND Authorised='1';