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.0To Silly to Add a New User Programmatically?To Silly to Add a New User Programmatically?
Previous
 
Next
New Post
12/1/2006 8:53 AM
 

Hi Friends,

I just want to add a new user programmatically by using VB.NET and it doesn't work. What is going wrong?
The user should get the welcome Email containing the Verification Code.

The new rolee should be the MEMBERSHIP Role in the DNN portal.

Please help me, thanks in advance!

 

Protected

 

 

 

 

 

PortalId = 0

 

 

 

user.Username =

 

user.Email =

 

user.DisplayName =

 

user.FirstName =

 

user.LastName =

 

user.PortalID = PortalId

user.Membership.Password =

 

user.Membership.Email =

 

user.Membership.Approved =

 

user.Membership.Username =

 

user.Profile.InitialiseProfile(PortalId)

 

UserInfo.Profile.SetProfileProperty(

UserController.UpdateUser(PortalId, user)

user.Profile.FirstName =

 

user.Profile.LastName =

 

user.Profile.Unit =

 

user.Profile.Street =

 

user.Profile.City =

 

user.Profile.PostalCode =

 

user.Profile.Telephone = "

 

user.Profile.PreferredLocale =

 

 

 

status_ = UserController.CreateUser(user)

 

 

 

 

 

 

Response.Write(status_.ToString)

 

 

Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.ClickDim UserInfo As New UserInfoDim PortalId As IntegerDim settings As PortalInfo' let's create a new user and inform the user by Email...Dim user As New UserInfo()"""""""""""123456" 'UserController.GeneratePassword()""True"""Membership", "Membership")"""""empty""empty""empty"""""de-DE"Dim status_ As DotNetNuke.Security.Membership.UserCreateStatusEnd Sub
 
New Post
3/1/2007 7:33 PM
 

I have the same issue.

Have you figure out how to do it ?

 
New Post
3/1/2007 8:53 PM
 

This is out of context, ignore the property stuff - it's for a single sign on feature I have - but it should get the point across..

 

 

 

 

 

objNewUser.PortalID = portalsettings.PortalId

objNewUser.Email = Email

objNewUser.Username = Username

objNewUser.Membership.Password = Password

objNewUser.Membership.Approved =

 

objNewUser.DisplayName = Username

 

 

 

 

userCreateStatus = UserController.CreateUser(objNewUser)

 

 

 

objEventLog.AddLog(objNewUser, portalsettings, objNewUser.UserID, Username, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.USER_CREATED)

 

 

Mail.SendMail(portalsettings.Email, portalsettings.Email,

DotNetNuke.Services.Localization.Localization.GetSystemMessage(portalsettings.DefaultLanguage, portalsettings,

DotNetNuke.Services.Localization.Localization.GetSystemMessage(portalsettings.DefaultLanguage, portalsettings,

 

 

 

 

 

 

 

 

 

 

 

 

 

nRDUser.PortalId = portalsettings.PortalId

nRDUser.Username = Username

dsUsers.rd_User.Addrd_UserRow(nRDUser)

 

 

 

npr.RDUserId = nRDUser.RDUserId

npr.UserProfilePropertyDefinitionId = p.PropertyDefinitionId

npr.LocalPropertyValue = p.PropertyValue

npr.SSPropertyValue = p.PropertyValue

npr.LastLocalUpdatedRDUserId = -1

npr.LastLocalUpdatedDate = rightnow

npr.LastSSContactDate = rightnow

npr.LastSSUpdatedDate = rightnow

npr.IsStale =

 

npr.IsVerified =

 

dsUsers.rd_UserProfile.Addrd_UserProfileRow(npr)

 

 

taRDUser.Update(dsUsers.rd_User)

taRDUserProfile.Update(dsUsers.rd_UserProfile)

 

 

 

 

taUser.FillByRDUserIdPortalId(dsAccount.rd_User, nRDUser.RDUserId, portalsettings.PortalId)

 

na.PortalId = portalsettings.PortalId

na.AccountTypeId = RealDropzone.LookupTables.AccountType.Personal

na.Name = nRDUser.Username &

 

na.IsActive =

 

dsAccount.rd_Account.Addrd_AccountRow(na)

 

nua.AccountId = na.AccountId

nua.RDUserId = nRDUser.RDUserId

nua.AllocationOrder = 1

dsAccount.rd_UserAccount.Addrd_UserAccountRow(nua)

taAccount.Update(dsAccount.rd_Account)

taUserAccount.Update(dsAccount.rd_UserAccount)

 

 

 

Private Sub CreateUser(ByRef portalsettings As PortalSettings, ByVal Email As String, ByVal Username As String, ByVal Password As String)Dim userCreateStatus As UserCreateStatus = userCreateStatus.AddUserDim objNewUser As New UserInfoTrue'objNewUser.AffiliateID = AffiliateId'todo: implement affiliates!If userCreateStatus = userCreateStatus.Success ThenDim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController' send notification to portal administrator of new user registration"", _"EMAIL_USER_REGISTRATION_ADMINISTRATOR_SUBJECT", objNewUser), _"EMAIL_USER_REGISTRATION_ADMINISTRATOR_BODY", objNewUser), _"", "", "", "", "", "")ElseThrow New Exception("user create failed: " & UserController.GetUserCreateStatus(userCreateStatus))End IfIf userCreateStatus = DotNetNuke.Security.Membership.UserCreateStatus.Success ThenDim dsUsers As New RealDropzone.UsersDataSetDim taRDUser As New RealDropzone.UsersDataSetTableAdapters.rd_UserTableAdapterDim taRDUserProfile As New RealDropzone.UsersDataSetTableAdapters.rd_UserProfileTableAdapterDim nRDUser As RealDropzone.UsersDataSet.rd_UserRow = dsUsers.rd_User.Newrd_UserRowFor Each p As DotNetNuke.Entities.Profile.ProfilePropertyDefinition In objNewUser.Profile.ProfilePropertiesDim rightnow As DateTime = NowDim npr As RealDropzone.UsersDataSet.rd_UserProfileRow = dsUsers.rd_UserProfile.Newrd_UserProfileRowFalseFalseNextDim dsAccount As New RealDropzone.AccountDataSetDim taAccount As New RealDropzone.AccountDataSetTableAdapters.rd_AccountTableAdapterDim taUserAccount As New RealDropzone.AccountDataSetTableAdapters.rd_UserAccountTableAdapterDim taUser As New RealDropzone.AccountDataSetTableAdapters.rd_UserTableAdapterDim na As RealDropzone.AccountDataSet.rd_AccountRow = dsAccount.rd_Account.Newrd_AccountRow" - Primary Account"TrueDim nua As RealDropzone.AccountDataSet.rd_UserAccountRow = dsAccount.rd_UserAccount.Newrd_UserAccountRowEnd IfEnd Sub
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0To Silly to Add a New User Programmatically?To Silly to Add a New User Programmatically?


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