DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Transfer users

Sort:
You are not authorized to post a reply.





New Around Here





    Hi, I have a very old DNN 4.7 website. I have a question - is it possible somehow to transfer users from DNN 4.7 to DNN 9 or 9.1?

    I know how to create users programmatically, but I need to preserve User Id and credentials.

    Thank you.

     






    Veteran Member





      AFAIK. there's no way to do this while keeping the UserIds as these are created when the user is created.
      You could however search for tables that store the UserId and change that value to the new userid maybe?
       






      New Around Here





        Thank you for reply. Is there any option to upgrade DNN 4.7 to DNN 9?






        Growing Member





          Hi - there is a suggested upgrade path at this link, that has been good for me since v2 days...
          https://docs.dnncommunity...rade-path/index.html

          Read the release notes, backup (database and files) at each stage so you can recover if something goes wrong, and don't be tempted to skip stages.





          New Around Here





            Thanks






            New Around Here





              Hi Alex

              Not sure if this helps, and I cannot remember the original version of DNN I started with but it was a system I started in 2016/17.

              I have system, for volunteer drivers, where users have a login to DNN but their Roles in the system mean that UserID 1 may be a Coordinator and UserID 2 may be a Driver so DNN UserID = 2 links to DriverID = 1

              What I'm interested in is you mention you know programmatically how to add new users. Now originally I had a DNN module that Bulk added users from a CSV file, but since DNN changed the development environment from VB (?) to C (#) that module is no longer supported.

              Two questions

              1. Have you developed a similar module

              2. Do you know the SQL code that adds users

              All the best

              Dave

               

               

               

               






              New Around Here





                Hi, please use this code as an example

                 

                Public Function AddUser() As Long

                        Dim oUserInfo As New UserInfo

                        With oUserInfo
                            .PortalID = 0
                            .Membership.Username = NickName
                            .Username = NickName
                            .Profile.FirstName = FirstName
                            .FirstName = FirstName
                            .Profile.LastName = LastName
                            .LastName = LastName
                            .Membership.Email = Email
                            .Email = Email
                            .Membership.Approved = True
                            .AffiliateID = Null.NullInteger

                            If Me.IsRandomPassword = False Then
                                .Membership.Password = Password
                                .Membership.PasswordQuestion = "aaa"
                                .Membership.PasswordAnswer = "bbb"
                            Else
                                Password = UserController.GeneratePassword
                                .Membership.Password = Password
                            End If
                            .Profile.ProfileProperties("Facility").PropertyValue = Facility
                            .Profile.ProfileProperties("Street").PropertyValue = Me.Address
                            .Profile.ProfileProperties("Unit").PropertyValue = Me.Apartment
                            .Profile.ProfileProperties("City").PropertyValue = Me.City
                            .Profile.ProfileProperties("Region").PropertyValue = Me.State
                            .Profile.ProfileProperties("PostalCode").PropertyValue = Me.Zip
                            .Profile.ProfileProperties("Zip4").PropertyValue = Me.Zip4
                            .Profile.ProfileProperties("Telephone").PropertyValue = Me.HomePhone
                            .Profile.ProfileProperties("WorkPhone").PropertyValue = Me.WorkPhone
                            .Profile.ProfileProperties("Cell").PropertyValue = Me.CellPhone
                            .Profile.ProfileProperties("DOB").PropertyValue = Me.DOB
                            .Profile.ProfileProperties("SSN").PropertyValue = Me.SSN
                            .Profile.ProfileProperties("Sex").PropertyValue = Me.Sex
                            .Profile.ProfileProperties("LanguagePreferences").PropertyValue = Me.LanguagePreference
                            .Profile.ProfileProperties("Language").PropertyValue = Me.Language
                            .Profile.ProfileProperties("Supervisor").PropertyValue = Supervisor
                            .Profile.ProfileProperties("AvailableDepartments").PropertyValue = AvailableDepartments
                            .Profile.ProfileProperties("Extension").PropertyValue = Me.Extension
                            .DisplayName = oUserInfo.FirstName & " " & oUserInfo.LastName
                        End With

                        Dim createStatus As UserCreateStatus = UserController.CreateUser(oUserInfo)

                        If createStatus = UserCreateStatus.Success Then
                            Dim MyID As Long = oUserInfo.UserID
                            Dim Role As New RoleInfo


                            Role = Me.RoleByName("Registered Users")
                            Dim PortalSettings As New PortalSettings
                            RoleController.AddUserRole(oUserInfo, Role, PortalSettings, Null.NullDate, Null.NullDate, MyID, False)

                            If CityAdmin Then
                                Role = Me.RoleByName("City Administrators")
                                RoleController.AddUserRole(oUserInfo, Role, PortalSettings, Null.NullDate, Null.NullDate, MyID, False)
                            ElseIf Inspector Then
                                Role = Me.RoleByName("Audit Inspector")
                                RoleController.AddUserRole(oUserInfo, Role, PortalSettings, EffectiveDate, ExpiryDate, MyID, False)
                            Else
                                Dim RoleNames() As String = RoleName.Split(",")
                                For r As Integer = 0 To RoleNames.Length - 1
                                    Role = Me.RoleByName(RoleNames(r))
                                    RoleController.AddUserRole(oUserInfo, Role, PortalSettings, Null.NullDate, Null.NullDate, MyID, False)
                                Next
                            End If
                           
                            Return MyID
                        End If

                    End Function






                Veteran Member





                  As Timo mentioned, there's no "easy" way to move users from DNN 4.x to a more recent version like 9.xx. It would have to be something where you build a connection to "import" the users via code, as you suggested.

                  As far as upgrading, it can certainly be done. In fact, we've done a handful of 4.xx upgrades last year. Though, depending on the website, it may be more economical to just rebuild the website and import the users.
                  You are not authorized to post a reply.

                  These Forums are dedicated to the discussion of DNN Platform.

                  For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

                  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
                  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
                  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
                  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
                  5. No Flaming or Trolling.
                  6. No Profanity, Racism, or Prejudice.
                  7. Site Moderators have the final word on approving / removing a thread or post or comment.
                  8. English language posting only, please.

                  Would you like to help us?

                  Awesome! Simply post in the forums using the link below and we'll get you started.

                  Get Involved