Friday, May 14, 2010

retreiving user information over DotNetNuke CMS

There is a property called UserInfo on the base class your module should be inherting.(DotNetNuke.Entities.Modules.PortalModuleBase). UserInfo has the details your after. So you could use (this|me).UserInfo.UserID, or if you don't need the extra details involved in the UserInfo object you could also use (this|me).UserId as well.

Forgive the C# below, if you need a vb version and C# is totally off the wall to you let me know and I will list that as well. Anyway, To load a userinfo up from an ID you have or have stored stored somewhere like the db =), you can get the details of them like so...

DotNetNuke.Entities.Users.UserController oUserController = new DotNetNuke.Entities.Users.UserController();

DotNetNuke.Entities.Users.UserInfo oUserInfo = oUserController.GetUser(this.PortalId, iSomeUserID);

oUserController = null;

//Set Some Label or textbox.Text of the username

txtSomeTxtBox.Text = oUserInfo.Username;


No comments:

Post a Comment