Thank you again Brian.
Sorry about the last post, I did not notice you were ASKING if CreateRole is on line 506 but that is correct.
I tried RoleProvider.Instance().CreateRole(RoleName) but then I get the error: "RoleProvider' is ambiguous, imported from the namespaces or types 'DotNetNuke.Security.Roles, System.Web.Security'."
I dont know if CreateRole is a proper "Method" or not? Really I dont know much at all about Role providers etc. I am really needing to get this working in a hurry and am just relieing on what info I can find using google.
This is what I am currently trying to get to work but with errors also. I found this code sample on another page and am trying to get it to fit my needs. Can you tell me either how to get it to work or if there is a totally different way to do what I am needing to do. My ultimate goal is to be able to have a small module for admins where I can input a users name in a textbox then on button click, the code create's 1 role and assignes the user to that role & creates a couple other role that go along with it. The bult of the code I can handle no problem, I just cannot get it to dynamically create the roles. Also, how do I get it to set the price and term period along with the role?
Current code:
Dim UserName1 As String
Dim RoleName1 As String
UserName1 = (selectedRole & "2")
RoleName1 = (Role1 & selectedWeek)
Dim objRoleController As DotNetNuke.Security.Roles.RoleController
objRoleController = New DotNetNuke.Security.Roles.RoleController
Dim userId As Integer = UserController.GetUserByName(0, UserName1)
Dim objRoles As New RoleController
Dim roleId As Integer = objRoles.GetRoleByName(PortalSettings.PortalId, RoleName1)
objRoleController.AddUserRole(PortalSettings.PortalId, userId, roleId, Null.NullDate, Null.NullDate)
Errors:
Value of type 'DotNetNuke.Entities.Users.UserInfo' cannot be converted to 'Integer'.
Value of type 'DotNetNuke.Security.Roles.RoleInfo' cannot be converted to 'Integer'.
The code is getting the username and the target role name from text boxes. How can I find out the UserId & RoleId from the UserName & RoleName?