daoustma
  •  daoustma
  • 54.8% (Neutral)
  • YAF Forumling Topic Starter
2009-02-14T15:18:00Z
If none of the forums in a category are visible to user, the category should not be visible either, hoever at the moment the category is still visible.

I actually fixed this myself on the code I downloaded and post eh fix I added if someone wants it.

Sponsor
Jaben
  •  Jaben
  • 100% (Exalted)
  • YAF Developer
2009-02-14T16:43:14Z
yes, please provide... it can go back into the main source.
daoustma
  •  daoustma
  • 54.8% (Neutral)
  • YAF Forumling Topic Starter
2009-02-14T17:55:13Z
Ok, I'm not that familiar with the source yet, so there is probably a better to do this, but this is what I did.

In pages/forum.ascx.cs in the Page_Load method, I added the following code immediatly folloing the call to BindData().


//If no forums are visible in a category, then hide the category
foreach (RepeaterItem item in CategoryList.Items)
{
    YAF.Controls.ForumList tmpForumList = (YAF.Controls.ForumList)item.FindControl("forumList");
    Repeater r  = (Repeater)tmpForumList.FindControl("ForumList1");
    DataRow[] row = (DataRow[])r.DataSource;  
    if (row.Length < 1)
    {
        item.Visible = false;
    }
}


The variables probably need better names since I was just messing around when I did it.
Mek
  •  Mek
  • 100% (Exalted)
  • YAF Developer
2009-02-15T00:24:45Z
Not sure if this has already been fixed in the SVN but I'll check and amend as necessary. Thanks for the contribution.
FP:Mek

UserPostedImage 

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )
Jaben
  •  Jaben
  • 100% (Exalted)
  • YAF Developer
2009-04-10T16:54:56Z
Fixed and committed the fix.
pavel
  •  pavel
  • 54.8% (Neutral)
  • YAF Forumling
2009-04-16T11:16:08Z
Hello,

this bug/feature was introduced in version 1.9.3 and was not present in 1.9.1.

Recently I've tracked this and found out, that in YAF.Classes.Utils\DB\DBBroker.cs.board_layout caching category list is not very good idea and replaced code beginning "//// get the Category Table" with following code:


		DataTable category = DB.category_listread( boardID, userID, null );
                category.TableName = DBAccess.GetObjectName("Category");


Not sure, which solution is better (not caching vs. removing empty categories at runtime) and which consumes less system resources. Maybe Jaben should decide.

HTH
Pavel
Nightvision
2009-06-23T20:26:41Z
This bug still lives, or maybe lives again? Anyhow, it's still happening.

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