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.0Create User Programmatically in 4.7Create User Programmatically in 4.7
Previous
 
Next
New Post
2/27/2008 2:05 PM
 

I need to create users in a module I'm doing in 4.7.  I have seen code posted here but it is not working for me, lots of missing objects and I cannot figure out what is going on. 

Is anybody creating users with their own code in DNN 4.7???  Would you share the code?

Thanks.

Carlos

 

 
New Post
2/27/2008 2:14 PM
 

If you download the source code package, you can see precisely how it works.  

The code you're looking to use is in the library/components/users folder.

There's a Shared method named CreateUser(ByRef objUser As UserInfo)

So... create your UserInfo object (also in the same folder) and call UserController.CreateUser(userInfoObject)

 

 
New Post
2/27/2008 10:47 PM
 

Yes I know, I tried looking at the source code but it is so modularized and complex, that my setup was not working properly and some classes were not working right so I could not follow and see how they are defined.  And to be honest, I cannot dedicate the time at the moment to go through the whole thing, I'm looking for help because of that exact reason.

Thanks anyway.

Carlos

 

 
New Post
2/28/2008 8:28 AM
 

see:

http://www.codeplex.com/IWeb/SourceControl/FileView.aspx?itemId=6339&changeSetId=8277

Dim oUserInfo As New UserInfo()
           oUserInfo.PortalID = IWebCredentials.PortalID
           oUserInfo.Membership.Username = NewUsername
           oUserInfo.Username = NewUsername
           oUserInfo.FirstName = FirstName
           oUserInfo.LastName = LastName
           oUserInfo.DisplayName = DisplayName
           oUserInfo.Membership.Email = email
           oUserInfo.Email = email
           oUserInfo.Membership.Approved = True
           oUserInfo.AffiliateID = Null.NullInteger
           oUserInfo.Membership.Password = Newpassword

Dim objUserCreateStatus As Security.Membership.UserCreateStatus = IWebUser.CreateUser(oUserInfo)

           If objUserCreateStatus = Security.Membership.UserCreateStatus.Success Then
               objResponse = "Success"
           Else
               objResponse = [String].Format("Error: {0}", objUserCreateStatus.ToString())
           End If



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
2/28/2008 8:56 AM
 

Michael:

Thanks once more for your help.  I will give that code a try later today, from what I have seen that may be all I need.

By the way, the reason I want to do this, and this need has been presented here before, is to allow a non DNN Admin to create user accounts for the specific application  I'm doing (the DNN module).  Maybe this could be a built-in role in the future, Accounts Admin without the privilege to modify anything in the site.  Also, and this is part of my module design, I added a boolean field to the Users table as a flag to my module to see what accounts were created from the module's Accounts Admin.  In that way the Application Admin can only modify accounts created from within the module.

Thanks again.

Carlos

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Create User Programmatically in 4.7Create User Programmatically in 4.7


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