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...Administration ...Administration ...Custom User RegistrationCustom User Registration
Previous
 
Next
New Post
11/1/2011 9:48 AM
 
Hello,

I am trying to create a custom user registration module for my website... I have working code from DNN5.x ..
but this code does not work in DNN6 ... any advise would be appreciated.
   
       protected void btnRegister_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            bool isValid = true;

            UserLoginStatus loginStatus = UserLoginStatus.LOGIN_FAILURE;
            if (Page.IsValid)
            {
                DotNetNuke.Entities.Users.UserInfo oUser = new DotNetNuke.Entities.Users.UserInfo();
                string newguing = System.Guid.NewGuid().ToString("N");

                oUser.Profile.InitialiseProfile(PortalId);
                oUser.PortalID = PortalId;
                oUser.Profile.SetProfileProperty("Company", tbCompany.Text);
                oUser.Profile.SetProfileProperty("Phone", tbPhone.Text);
                oUser.Profile.SetProfileProperty("Address", tbAddress.Text);
                oUser.Profile.SetProfileProperty("Name", tbName.Text);

                oUser.DisplayName = tbName.Text.Trim();
                oUser.IsSuperUser = false;
                oUser.Membership.CreatedDate = DateTime.Now;
                oUser.Membership.Email = tbEmail.Text;
                oUser.Membership.Password = tbPassword.Text;
                oUser.Membership.Username = tbEmail.Text.Trim();
                oUser.Membership.Approved = true;

                UserUserControlBase.UserCreatedEventArgs args = new UserUserControlBase.UserCreatedEventArgs(null);
                UserCreateStatus status = UserController.CreateUser(ref oUser);

                if (UserCreateStatus.Success == status)
                {
                    args = new UserUserControlBase.UserCreatedEventArgs(oUser);
                    args.Notify = true;

                    UserInfo objUser = UserController.ValidateUser(PortalId, oUser.Username, tbPassword.Text, "DNN", "", PortalSettings.PortalName, Dns.GetHostName(), ref loginStatus);

                    UserAuthenticatedEventArgs eventArgs = new UserAuthenticatedEventArgs(objUser, oUser.Username, loginStatus, "DNN");
                    eventArgs.Authenticated = false;
                    eventArgs.Message = String.Empty;
                }

                args.CreateStatus = status;
                UserUserControlBase objUserBase = new UserUserControlBase();
                objUserBase.OnUserCreated(args);
                objUserBase.OnUserCreateCompleted(args);
            }
        }


Thanks,
 
New Post
11/1/2011 10:00 AM
 
never mind .. this actually works .. I forgot to set up one of the profile properties ...

cheers
 
New Post
11/30/2012 8:59 AM
 
Hi,Can you please share what profile properties must be set to make it working.I am also trying to send notification mail after registration, Admin is receiving mail, but not the user.I am also setting custom profile properties as belowuser.Profile.SetProfileProperty("ExternalID", extID)user.Profile.SetProfileProperty("ExternalSn", txtSNo.Text.Trim)but when i see profile after registration both are blank.Can you please help with this regards.Thanks
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Custom User RegistrationCustom User Registration


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