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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Create User Create User
Previous
 
Next
New Post
11/10/2011 6:11 AM
 
Hi all,

I am working on creating a new user programmatically in C#. It all works fine apart from the Approved bit.

What is happening is oUser.Membership.Approved is always adding as true. Even if i do

oUser.Membership.Approved = false;

The user still adds into the system is true. Any ideas why? DNN 6.0.2

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

oUser.PortalID = this.PortalId;
oUser.IsSuperUser = false;
oUser.FirstName = User_FirstName.Text;
oUser.LastName = User_LastName.Text;
oUser.Email = User_EmailAddress.Text;
oUser.Username = User_EmailAddress.Text;
oUser.DisplayName = User_FirstName.Text + " " + User_LastName.Text;

bool AuthUser = (User_Authorise.SelectedValue == "1" ? true : false);
oUser.Membership.Approved = AuthUser;

oUser.Profile.PreferredLocale = PortalSettings.DefaultLanguage;
oUser.Profile.FirstName = oUser.FirstName;
oUser.Profile.LastName = oUser.LastName;
oUser.Membership.CreatedDate = System.DateTime.Now;
oUser.Membership.IsOnLine = false;
oUser.Membership.Password = "testing";

try {
if (DotNetNuke.Security.Membership.UserCreateStatus.Success == DotNetNuke.Entities.Users.UserController.CreateUser(ref oUser))
{
}
catch (System.Exception ex)
{
}

Thanks

 
New Post
11/15/2011 6:48 AM
 
i suspect that the approved bit is being set later based on the type of registration i.e. a site with public registration always has approved users, whereas verified always has approved set to false.

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
11/16/2011 3:42 AM
 
Managed to fix this thanks. It was due to postback issues.
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Create User Create 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