Your question has been submitted and is awaiting moderation.
Thank you for reporting this content, moderators have been notified of your submission.
Hi,
I need to be able to create a new user and set the value of a custom profile property. Please see my code below which creates the new user, sets the value of a default property (Biography) and also sets the value of my custom property (CRMContactID), however, the custom property value doesn't save. I have tried both UserController.UpdateUser() and ProfileController.UpdateUserProfile() to do the update but neither seem to work for me.
Any help would be very much appreciated. Thanks.
Dim objUserInfo As New UserInfo
With objUserInfo
.DisplayName = myFirstName & " " & myLastName
.Email = myEmailAddress
.FirstName = myFirstName
.LastName = myLastName
.Username = myEmailAddress
.IsSuperUser = False
.PortalID = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings().PortalId
.Membership = New UserMembership(objUserInfo)
.Membership.Password = myPassword
.Membership.Approved = isApproved
.Membership.UpdatePassword = passwordUpdateRequired
End With
Dim objCreateStatus As DotNetNuke.Security.Membership.UserCreateStatus = UserController.CreateUser(objUserInfo)
If objCreateStatus = DotNetNuke.Security.Membership.UserCreateStatus.Success Then
With objUserInfo
.Profile.Biography = "still testing"
.Profile.SetProfileProperty("BMFAContactID", myBMFAContactID)
End With
UserController.UpdateUser(DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings().PortalId, objUserInfo)
'DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(objUserInfo)