Hi,
I am trying to get the userId (of the UserInfo object) of the user selected by the admin user in the Manage --> Users --> (Choose a user) -> View Profile page
Using SecurityContext.getCurrentUser() or UserController.Instance.GetCurrentUserInfo() gets me the userInfo object of the currently logged on user as it should (which is the admin user in this case). But I need the userInfo object of the selected user.
Note: I am using DNN 9.4.4
Thanks in advance.
Mohan,
This should work for you:
DotNetNuke.Entities.Users.UserController.GetUserByName(string username)
or
DotNetNuke.Entities.Users.UserController.GetUserByName(int portalId, string username)
Happy DNNing! Michael
Michael TobischDNN★MVP
Hi Micheal,
Thanks for the reply. The problem I have is how do I get the username to pass as the argument. Because I dont want the UserInfo of the currently logged on user. I need the UserInfo of the user selected from the Users list in Manage --> Users
you have to know something about the user, either the user name (see example above, you find this in the first column of the grid in the second line) or the userid (eg when you click on the profile link, you see it in the querystring).
If you know the userid, you can get the UserInfo object by
DotNetNuke.Entities.Users.UserController.GetUserById(int portalId, int userId)
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.