YAFLogo

johans
  • johans
  • 51.8% (Neutral)
  • YAF Lover Topic Starter
10 years ago
Hello all

I've ran my head into a wall now for a day or two. I've got an YAF 1.9.6.2 BETA 20120612 installation running with one board, and it works great. Now i need to, on the same installation (database & directories are all the same), start another board.
I created an board from the Hosting webs, then through sql copied the old board data (users, groups, usergroup, categories, forum, accessmasks, forumaccess, ranks, registry, bbcode, extension and topicstatus). I even copied the guest user to the new board. I've double checked all the FK's, and they looks good.

When i browse to the site as an guest, i get an empty board. I guess that means some FK's are wrong, but i can't find them.
Also, if i access it as an user, through Membership provider of my own, i get no access. And a new user is created in the User table with the exact information as the user i just tried to log in as (providerkey & name), but got the wrong BoardId (default 1 i guess).

I do have in my code (3 is the newly created board id).
When i enter the Page_Init() on the page where i have the control, YafContext.Current.Settings.BoardID is 1. I searched around and it seems BoardId is set to 1 by default (return YafControlSettings.Current == null ? 1 : YafControlSettings.Current.BoardID;)

Any pointers where to continue?

I have since i don't want different directories, and is NOT set in the config file.
Sponsor

johans
  • johans
  • 51.8% (Neutral)
  • YAF Lover Topic Starter
10 years ago
Some more info from my digging.

I'm cleaning out
DELETE yaf_ActiveAccess
DELETE yaf_Active

Then i start my application with , and accesses the forum as an logged out user.

Checking the database

SELECT *
FROM dbo.yaf_Active AS a

SELECT *
FROM dbo.yaf_ActiveAccess AS aa

Both are filled with items from BoardId=1.
johans
  • johans
  • 51.8% (Neutral)
  • YAF Lover Topic Starter
10 years ago
One step closer. It seems setting BoardId in control

Quote:



works, but when i do it from code

Quote:



and in Page_Load or OnInit
forum.BoardID = 3;



it breaks (the code behind is ignored).

Edit: i need to have it in code behind since i'm having multiple boards.
johans
  • johans
  • 51.8% (Neutral)
  • YAF Lover Topic Starter
10 years ago
Oh well, it's always good when one can solve things on it's own, but spamming here first is... oh well.

Quote:



and in code behind:
Quote:

protected override void OnPreInit(EventArgs e) {
YafContext.Current.Settings.BoardID = 3;
}



fixed it.
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 3.0.3
10 years ago
Originally Posted by: johans 

Oh well, it's always good when one can solve things on it's own, but spamming here first is... oh well.

Quote:



and in code behind:
Quote:

protected override void OnPreInit(EventArgs e) {
YafContext.Current.Settings.BoardID = 3;
}



fixed it.



I dont think thats the right way of doing it i tested it with

 <YAF:Forum runat="server" ID="forum" BoardID="2">

and it works without any problems.

If you want to set the board id in the code behind do something similiar i did in the dnn module.

Put an empty PlaceHolder Control or Panel on the aspx page,instead of the forum Control

 <asp:PlaceHolder runat="server" ID="forumPlaceHolder"></asp:PlaceHolder>

and in the code behind

var forum = new Forum();

// Set Board ID
forum.BoardID = 3;

// You could also load a specific default category
//forum.CategoryID = 1;

this.forumPlaceHolder.Controls.Add(forum);
YAF Logo Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved
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