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

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...api to import users isnt setting them fully correctapi to import users isnt setting them fully correct
Previous
 
Next
New Post
10/7/2013 4:14 PM
 
here is my code. it seems it adds the wrong portal definitions to the user.
I am correctly setting the portalid for the user and portal settings.
what am I missing?
we have several portals and it used other portal definitions to assign to them.


Dim oUserInfo As New DotNetNuke.Entities.Users.UserInfo
oUserInfo.FirstName = oUser.Ektron_FirstName
oUserInfo.LastName = oUser.Ektron_LastName
oUserInfo.PortalID = iPortal
oUserInfo.Email = oUser.Ektron_Email
oUserInfo.Username = oUser.Ektron_Username
oUserInfo.DisplayName = oUser.Ektron_DisplayName
oUserInfo.Membership.Password = "xxxxxxx"
oUserInfo.IsSuperUser = False

'Fill MINIMUM Profile Items (KEY PIECE)
Dim p_Settings As New DotNetNuke.Entities.Portals.PortalSettings(iPortal)

oUserInfo.Profile.PreferredLocale = p_Settings.DefaultLanguage
oUserInfo.Profile.TimeZone = p_Settings.TimeZoneOffset
oUserInfo.Profile.FirstName = oUser.Ektron_FirstName
oUserInfo.Profile.LastName = oUser.Ektron_LastName

'Set Membership
Dim oNewMembership As UserMembership = New UserMembership()
oNewMembership.Approved = True
oNewMembership.CreatedDate = System.DateTime.Now
oNewMembership.Email = oUser.Ektron_Email
oNewMembership.IsOnLine = False
oNewMembership.Username = oUser.Ektron_Username
oNewMembership.Password = oUserInfo.Membership.Password 'oExternalUserAccount.Password

'Bind membership to user
oUserInfo.Membership = oNewMembership

Dim createStatus As DotNetNuke.Security.Membership.UserCreateStatus = DotNetNuke.Security.Membership.UserCreateStatus.AddUser
Dim memberProvider As DotNetNuke.Security.Membership.MembershipProvider = DotNetNuke.Security.Membership.MembershipProvider.Instance()

createStatus = memberProvider.CreateUser(oUserInfo)
If createStatus = DotNetNuke.Security.Membership.UserCreateStatus.Success Then
UserList.Text = "success"
 
New Post
10/7/2013 7:09 PM
 
at a glance i'd say the issue is that you aren't assigning the user to any portal role - see http://www.dnnsoftware.com/wiki/Page/Create-a-New-User-and-Add-to-Specific-Role-Programatically for an example

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
10/7/2013 10:58 PM
 
thx that looks good to add into my code
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...api to import users isnt setting them fully correctapi to import users isnt setting them fully correct


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