Bookmark and Share

Wednesday, March 21, 2012

Adding a Role to a DNN user using code

 

If you need to assign a Role to a user you can use this code:

Dim objRoleController As DotNetNuke.Security.Roles.RoleController

objRoleController = New DotNetNuke.Security.Roles.RoleController

objRoleController.AddUserRole(PortalId, User.UserID, RoleIdNumber, Null.NullDate, Null.NullDate)


Simple and working!