I have a code snippet to add new user.
// Creates a new user object
UserInfo newUser = new UserInfo();// Sets the user properties
newUser.FullName = firstName + @ @ + lastName;
newUser.UserName = StringUltils.RemoveSign4VietnameseString(userName.ToLower());
newUser.PasswordFormat = password;
newUser.Email = email;
newUser.PreferredCultureCode = cultureInfo.CultureCode;
newUser.UserSettings.UserWaitingForApproval = true;
newUser.SetValue(@Organisation@, organisation);
// Sets the user's privilege level to 'Editor'
newUser.SiteIndependentPrivilegeLevel = UserPrivilegeLevelEnum.None;
// Saves the user to the database
UserInfoProvider.SetUserInfo(newUser);
UserInfoProvider.SetPassword(newUser, password);
UserInfoProvider.AddUserToSite(newUser.UserName, SiteContext.CurrentSiteName);
And i also turn on 2 options:
- Registration requires email confirmation
- Registration requires administrator's approvalBut after run the code above, i just see the user in awaiting for approval list. And i didn't see any email confirmation. What i'm missing?. Thanks.
↧