Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom User Registration ProblemsCustom User Registration Problems
Previous
 
Next
New Post
8/11/2006 1:58 PM
 

I'm having an issue when my custom module is registering new users. The user and membership is created, but the profile doesn't get created or updated, and the First and Last name fileds do not get updated either. Below is the code I am using for adding a new user.

 

Dim userCreateStatus As UserCreateStatus = userCreateStatus.AddUser

Dim objUserInfo As DotNetNuke.Entities.Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetUserByName(0, "jpettit", False)

If objUserInfo Is Nothing Then

objUserInfo = New DotNetNuke.Entities.Users.UserInfo

Else

DotNetNuke.UI.Skins.Skin.AddModuleMessage(CurrentModule, "Username taken!", DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError)

Exit Sub

End If

With objUserInfo'.PortalID = 0

.FirstName = "Jeremy"

.LastName = "Pettit"

.Profile.SetProfileProperty("FirstName", "Jeremy")   ' .Profile.LastName =  and .LastName =  doesn't work either

.Profile.SetProfileProperty("LastName", "Pettit")     ' .Profile.FirstName =  and .FirstName =  doesn't work either

.Email = "jpettit@cdirad.com"

.Username = "jpettit"

.Membership.Password = "jpettit"

.Membership.Approved = True

.AffiliateID = Null.NullInteger

End With

 

userCreateStatus = DotNetNuke.Entities.Users.UserController.CreateUser(objUserInfo)

 
New Post
8/11/2006 3:23 PM
 
Found a temp fix, but I'd rather avoid doing this as it seems unnecessary and redundant. I am able to fill in the missing/blank fields such as first and last name by updating the user and user profile objects after I create the user.

'After creating user

objUserInfo = DotNetNuke.Entities.Users.UserController.GetUserByName(0, "jpettit")

With objUserInfo

.FirstName = "Jeremy"

.LastName = "Pettit"

DotNetNuke.Entities.Users.UserController.UpdateUser(0, objUserInfo)

.Profile.FirstName = "Jeremy"

.Profile.LastName = "Pettit"

DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(objUserInfo)

End With

 
New Post
8/11/2006 3:59 PM
 
i had similar problems.  i did it like this.

            Dim userCreateStatus As UserCreateStatus = userCreateStatus.AddUser

            Dim objNewUser As New UserInfo
            objNewUser.PortalID = PortalId
            objNewUser.Email = userControl.Email
            objNewUser.Username = userControl.UserName
            objNewUser.Membership.Password = userControl.Password
            objNewUser.Membership.Approved = Convert.ToBoolean(IIf(PortalSettings.UserRegistration <> PortalRegistrationType.PublicRegistration, False, True))

            userCreateStatus = UserController.CreateUser(objNewUser)

            If userCreateStatus <> userCreateStatus.Success Then
                DotNetNuke.UI.Skins.Skin.AddModuleMessage(Me, "<br/>Registration Failed: " + UserController.GetUserCreateStatus(userCreateStatus), DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError)
                Exit Sub
            End If

            Dim objUserInfo As UserInfo = UserController.GetUserByName(PortalId, objNewUser.Username, False)
            objUserInfo.Profile.SetProfileProperty("FirstName", userControl.FirstName)
            objUserInfo.Profile.SetProfileProperty("LastName", userControl.LastName)
            objUserInfo.Profile.SetProfileProperty("City", addressUser.City)
            objUserInfo.Profile.SetProfileProperty("Region", addressUser.Region)
            objUserInfo.Profile.SetProfileProperty("PostalCode", addressUser.Postal)
            objUserInfo.Profile.SetProfileProperty("Country", addressUser.Country)
            objUserInfo.Profile.SetProfileProperty("Telephone", addressUser.Telephone)
            objUserInfo.Profile.SetProfileProperty("Website", userControl.Website)
.
.
.
            UserController.UpdateUser(PortalId, objUserInfo


i hope this helps.


 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom User Registration ProblemsCustom User Registration Problems


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

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

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. 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.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out