Search code examples
asp.netdotnetnukedotnetnuke-7

Hot to get UserInfo in DNN7 - GetCurrentUserInfo is deprecated


I have been using GetCurrentUserInfo up until now but my company is moving to DNN 7.3 and some of our modules use this method to get the userInfo for the current user.

Dim userInfo As DotNetNuke.Entities.Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo()

When building for DNN 7.3 we are now getting a warning:

Warning BC40000 'Public Shared Overloads Function GetCurrentUserInfo() As UserInfo' is obsolete: 'Deprecated in DNN 7.3. Replaced by UserController.Instance.GetCurrentUserInfo()'. 

What is the correct current way to get the same UserInfo? I have tried following the warning's advice but I still get the same warning : "GetCurrentUserInfo() As UserInfo' is obsolete..."


Solution

  • Change all entries from

    DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo()
    

    to

    DotNetNuke.Entities.Users.UserController.Instance.GetCurrentUserInfo()