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.0HOW TO: Programmatically Create New UserHOW TO: Programmatically Create New User
Previous
 
Next
New Post
6/8/2007 1:13 PM
 

 Here is what I do (DNN 4.5.1):              

 DotNetNuke.Entities.Users.UserInfo user_ = new DotNetNuke.Entities.Users.UserInfo();

 
                user_.PortalID = PortalId;
                user_.FirstName = txtFName_.Text;
                user_.Profile.FirstName = txtFName_.Text;
                user_.LastName = txtLName_.Text;
                user_.Profile.LastName = txtLName_.Text;
                user_.DisplayName = user_.FirstName + ' ' + user_.LastName;
 
                user_.Profile.Street = ctlAddress_.Street;
                user_.Profile.Unit = ctlAddress_.Unit;
                user_.Profile.City = ctlAddress_.City;
                user_.Profile.Region = ctlAddress_.Region;
                user_.Profile.PostalCode = ctlAddress_.Postal;
                user_.Profile.Telephone = ctlAddress_.Telephone;
                user_.Email = txtEmail_.Text;
                user_.Username = txtUsername.Text;
 
                user_.Membership.Email = txtEmail_.Text;
                user_.Membership.Username = txtUsername.Text;
                user_.Membership.Password = WebHelper.RandomPassword.Generate(8, 10); //This is our own routine to create random passwords
                user_.Membership.Approved = false;
                user_.AffiliateID = -1;
 
                try
                {
                    user_.UserID = Session["userId"] != null ? user_.UserID = int.Parse(Session["userId"].ToString()) : -1;
                }
                catch { }
 
                if (user_.UserID > 0)
                {
                    DotNetNuke.Entities.Users.UserController.UpdateUser(PortalId, user_);
                }
                else
                {
                    UserCreateStatus createStatus = DotNetNuke.Entities.Users.UserController.CreateUser(ref user_);
                }

Vitaly Kozadayev
Principal
Viva Portals, L.L.C.
 
New Post
6/8/2007 1:23 PM
 

Vitkoz:  Thank you so much for contributing...  Have you checked your DB and verified that the profile properties that you specified in your routine are actually in the UserProfile table for the users created this way?


Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
New Post
6/8/2007 1:49 PM
 

Hey Vitkoz, is this what you are using for your password generator?

http://www.obviex.com/Samples/Password.aspx

I like it, but I have not yet used it extensively.

Also...  I see you trying to grab a userid in the Try/Catch block.  Where are you assigning the Session["userid"] property?  Is this something else that you are generating?


Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
New Post
6/8/2007 2:20 PM
 

Will,

We most definitely verified that. We use those profile settings all over the application, so we would've had a problem if profile properties were not populated correctly - for example address wouldn't show up.


Vitaly Kozadayev
Principal
Viva Portals, L.L.C.
 
New Post
6/8/2007 2:24 PM
 

Will,

You are correct - in the page_onload we examine url for userid (it is passed from a user list if Edit was clicked, or it is not is Add was...) If it is actually passed, then we retreive the record and also set userid to a Session variable "userId". However, lately I've been leaning toward not saving it into a session variable but just getting it again from the url. This way i don't hav to worry about cleaning it up once they are done adding/updating the record...


Vitaly Kozadayev
Principal
Viva Portals, L.L.C.
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0HOW TO: Programmatically Create New UserHOW TO: Programmatically Create New User


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