Posted by: rai - Thursday, 8 December 2011 16:45:23 |
---|
Hi, I am doing some custom integration of the forum and my customers. I have managed to create a user but it does not seem to autocreate a row in yaf_UserGroup causing logon to fail. Is there a specific existing method for this or should just insert a row after creating the user? Here is my code for creating the user: [code=csharp]System.Web.Security.MembershipCreateStatus status; userInfo = System.Web.Security.Membership.CreateUser(txtLogin.Text, txtPassword.Text, c.YafUserID, txtQ.Text, txtA.Text, true,out status); if (status == System.Web.Security.MembershipCreateStatus.Success) { //userInfo.IsApproved = true; System.Web.Security.Membership.UpdateUser(userInfo); var p = Profile.GetProfile(userInfo.UserName); p.RealName = string.Format("{0} {1}", txtFirstName.Text, txtLastName.Text); p.Save(); db.ExecuteCommand("Update Contacts set YafUserID={0}, InviteCode=null,InviteSentOn=null Where YafUserID={1}", userInfo.UserName, c.YafUserID); // insert into yaf_UserGroup System.Web.Security.FormsAuthentication.SetAuthCookie(userInfo.UserName, true);[/code] Thanks! |
Posted by: tha_watcha - Thursday, 8 December 2011 18:30:19 |
---|
take a look at the yaf register page and you see how the user profile is setup...
[code=csharp]// setup/save the profile
YafUserProfile userProfile = YafUserProfile.GetProfile(this.CreateUserWizard1.UserName);
userProfile.Location = locationTextBox.Text.Trim();
userProfile.Homepage = homepageTextBox.Text.Trim();
userProfile.Save();
// save the time zone...
int userId = UserMembershipHelper.GetUserIDFromProviderUserKey(user.ProviderUserKey);
LegacyDb.user_save(
userId,
this.PageContext.PageBoardID,
null,
null,
null,
timeZones.SelectedValue.ToType |