Welcome Guest Search | Active Topics | Log In | Register

Problem - User import Options · View
loki
#1 Posted : Tuesday, August 12, 2008 10:23:11 AM

Rank: YAF Forumling


Joined: 7/31/2008
Posts: 3
Location: Dublin, Ireland
Hi all, have an issue importing users from an old board. I have an export of all the users from the old system but want to import them with a few tweaks into the new. if i didnt have to worry about passwords it would be fine but i cant see how to import all the users and where or how to link there passwords. Also apart from creating the users in the membership and users tables do i have any other links to create?

Here are the columns i have to work with from the old system.

Code:
User.USERNAME    User.PASSWORD    User.ID    User.DISPLAY_NAME    User.EMAIL    User.DISPLAY_EMAIL    User.TITLE    User.OCCUPATION    User.INTERESTS    User.LOCATION    User.SIGNATURE    User.PARENT_EMAIL    User.CUSTOM_1    User.CUSTOM_2    User.CUSTOM_3    User.CUSTOM_4    User.IP_AT_REGISTRATION    User.DOB    User.REGISTRATION_DATE    User.LAST_LOGIN_DATETIME    User.LAST_POST_DATETIME    User.HAS_OPTED_OUT_OF_EMAILS    User.ALLOW_PRIVATE_MESSAGES    User.NOTIFY_ON_PRIVATE_MESSAGES    User.CAN_USE_AVATARS    User.IGNORE_AVATARS    User.CAN_PARTICIPATE_IN_POLLS    User.IS_VALIDATED    User.IS_AGE_RESTRICTED_USER    User.IS_ADMINISTRATOR    User.IS_PROFILE_LOCKED    User.IS_PRIVATE_MESSAGING_DISABLED    User.IS_DOB_HIDDEN    User.IS_ACTIVITY_HIDDEN    User.IS_AVATAR_LOCKED    User.IS_BANNED    User.USER_POST_COUNT    User.CUMULATIVE_USER_POST_COUNT    User.DAY_PRUNE    User.PICTURE_URL    User.HOME_PAGE_URL    User.AVATAR_URL


N.
test2005
#2 Posted : Tuesday, August 12, 2008 1:17:46 PM

Rank: YAF MVP



Joined: 2/12/2005
Posts: 923
Location: Italy
I wrote a function (although it's in VB) that calls the "old user" table, then creates ASPNETDB accounts based on this information. Here it is...

Code:


Public Shared Function Create_New_User(ByVal NewUserName As String, ByVal NewUserPassword As String, ByVal NewUserEmail As String) As String

            Dim status As MembershipCreateStatus

            Try
                Dim newUser As MembershipUser = Membership.CreateUser(NewUserName, NewUserPassword, NewUserEmail, UserQuestion, UserAnswer, True, status)

                If newUser Is Nothing Then
                    Return Create_New_User_GetErrorMessage(status)
                Else
                    If Membership.ValidateUser(newUser.ToString, NewUserPassword) Then

                        Roles.AddUserToRole(newUser.UserName, "T4K_User")

                        Return "successful"

                    End If

                    Return "successful"

                End If
            Catch ex As Exception

                Return "An unknown error occurred."
            End Try
        End Function

        Public Shared Function Create_New_User_GetErrorMessage(ByVal status As MembershipCreateStatus) As String
            Select Case status
                Case MembershipCreateStatus.DuplicateUserName
                    Return "Username already exists. Please enter a different user name."
                Case MembershipCreateStatus.DuplicateEmail
                    Return "A username for that e-mail address already exists. Please enter a different e-mail address or use the password recovery feature."
                Case MembershipCreateStatus.InvalidPassword
                    Return "The password provided is invalid. Please enter a password at least 6 characters long."
                Case MembershipCreateStatus.InvalidEmail
                    Return "The e-mail address provided is invalid. Please check the value and try again."
                Case MembershipCreateStatus.InvalidAnswer
                    Return "The password retrieval answer provided is invalid. Please check the value and try again."
                Case MembershipCreateStatus.InvalidQuestion
                    Return "The password retrieval question provided is invalid. Please check the value and try again."
                Case MembershipCreateStatus.InvalidUserName
                    Return "The user name provided is invalid. Please check the value and try again."
                Case MembershipCreateStatus.ProviderError
                    Return "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact " & SystemDefault_Get(6).ToString & " usng the contact page."
                Case MembershipCreateStatus.UserRejected
                    Return "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact " & SystemDefault_Get(6).ToString & " usng the contact page."
                Case Else
                    Return "An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact " & SystemDefault_Get(6).ToString & " usng the contact page."
            End Select
        End Function



So, create a page that calls a dataset from the DB of your "old" usernames. Then call the abouve function. If it returns "successful", move on to the next. If not, Response.Write the old username and error in creating the account to the page. Print it off and deal with them seperate.

HTH

Razz
.....the man in black fled across the desert..........and the gunslinger followed.....

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.3 RC2 | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.059 seconds.

SourceForge.net Logo Powered by ASP.NET v2.0 411ASP.NET