stowaway
  •  stowaway
  • 56% (Neutral)
  • YAF Camper Topic Starter
2010-12-22T10:40:30Z
I have created a webpage. and put YAF in the \forum directory..
this all works fine.
I used Yafs recommended .config with a few tweaks in the root directory.
(ie i tweaked it so i didnt have to use a secret question)

and i created a createuserwizard.. It uses the yafprovider and it all semes to work.
the user exists in the yaf_user table and also the yaf_prov_Membership

I can log in when i create users through the yaf forum. but when i create them throug this i get an error.
this is the event log:


System.ApplicationException: Failed to find guest user.
at YAF.Classes.Core.UserPageBase.InitUserAndPage()


ps- not sure if its relevent but in roles
guests is (unlinkable)
Sponsor
bbobb
  •  bbobb
  • 100% (Exalted)
  • YAF Developer
2010-12-22T12:38:15Z
Guest should be in tables Membership and RoleMembership and User.

stowaway
  •  stowaway
  • 56% (Neutral)
  • YAF Camper Topic Starter
2010-12-22T19:40:59Z
I dont have a guest tuple in yaf_prov_membership
and i dont think its in yaf_prov_RoleMembership although that is encrypted so im not sure.

How do i add them?

Also I dont want the users i create to be a guest. I Want them to be a registered user. do i need to call some methods on user_created to add their roles etc?
stowaway
  •  stowaway
  • 56% (Neutral)
  • YAF Camper Topic Starter
2010-12-23T10:41:48Z
okay I solved my problems.. what is probably obvious is i wasnt creating the needed YAF data.

This is how i fixed it. and it seems to work (although im only a n00b so it may not be the right way)

I just did the following after the user was created and the validation checks are done:
please note this assumes a bit.. ie board id 1. 600 timezone.



protected void createUser_created(object sender, EventArgs e)
{
System.Web.Security.MembershipUser user = UserMembershipHelper.GetUser(this.createUser.UserName);
YafUserProfile userProfile = YafUserProfile.GetProfile(this.createUser.UserName);
userProfile.Save();

// setup inital roles (if any) for this user
RoleMembershipHelper.SetupUserRoles(YafContext.Current.PageBoardID, this.createUser.UserName);

int? userID = RoleMembershipHelper.CreateForumUser(user, user.UserName, 1);

DB.user_save(
userID,
1,
null,
null,
null,
600,
null,
null,
null,
null,
null,
null,
null,
false,
null,
null);
}

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved