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 new user account with APICreate new user account with API
Previous
 
Next
New Post
7/4/2008 10:17 PM
 

Hi there,

I need to create user accounts with certain group-memberships from within my module.

Is there a way to do this via the API or do I have to "hack" this directly into the database?

 

Best regards,

Tillman

 
New Post
7/5/2008 6:07 PM
 

Quick Answer:
DotNetNuke.Entities.Users
DotNetNuke.Security.Roles
Slightly Longer Answer
Fill a UserInfo object
Use UserController.CreateUser(your filled userinfo object)
Get Role information with a RoleInfo object and Add/Delete roles to users with a RoleController object.

 

I hope that helps point you in the right direction.

 
New Post
7/5/2008 10:28 PM
 

Great! That sounds exactly like what I need.

Cheers,

 

Tillman

 
New Post
7/6/2008 4:09 PM
 

Baatezu wrote

Quick Answer:
DotNetNuke.Entities.Users
DotNetNuke.Security.Roles
Slightly Longer Answer
Fill a UserInfo object
Use UserController.CreateUser(your filled userinfo object)
Get Role information with a RoleInfo object and Add/Delete roles to users with a RoleController object.

I tried that with following code:

 

        Dim objUser As UserInfo = New UserInfo()
        objUser.FirstName = "test"
        objUser.LastName = "Tester"
        objUser.Username = "Tester"
        objUser.Email = "tester@domain.com"
 
        Dim st As UserCreateStatus
        st = UserController.CreateUser(objUser)

but got

st = “InvalidPassword”

I do not see the way how to assign the password to objUser. Could somebody please submit a bit of code?
Thanks

Vlado
 
New Post
7/6/2008 4:22 PM
 

see:

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

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
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Create new user account with APICreate new user account with API


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