Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DotNetNuke Retrieving UserInfo for the given UserID

Is there somthing in the dotnetnuke framework which will allow me to pass it a userId and it would return the UserInfo object filled with details of that userId.

If not what would be the normal way of doing this?

like image 438
shad Avatar asked Dec 01 '22 11:12

shad


2 Answers

Try this (in DNN 5.x with C#)

private UserInfo _currentUser =
                   DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();

Then use the UserInfo later...

int UserID = _currentUser.UserID
like image 110
user434247 Avatar answered Dec 18 '22 19:12

user434247


I used the way posted by bdukes with one modification: PortalId can be get from PortalSettings:

DotNetNuke.Entities.Users.UserInfo user = DotNetNuke.Entities.Users.UserController.GetUser(PortalSettings.PortalId, user_id, true);
like image 23
Nico Avatar answered Dec 18 '22 21:12

Nico