I’ve noticed a bug with the Forum Addon. The first page would be correctly themed but any subsequent pages were not when running against a build of the latest N2CMS.
On investigation it seems that the Forum Pages CurrentItem was resolving to null which prevented the ThemeConcern for assigning the correct theme:
Looking into the N2.Templates.dll that comes the the Forum Addon, it looks like things were handled differently back in the day, with the N2.Templates.Web.ThemeModifier just using the theme for that start page:
So, the fix is to make the forum page take the theme from the start page, without affecting other page types…..tricky whilst maintaining separation of concerns…hmm.
The FixThe fix has to belong with the forum addon so that the change in behaviour doesn’t knacker the standard n2cms features. N2CMS populates the CurrentItem property based on the current url and as the Forum Plugin is generating links directly to it’s core template (/Forum/UI/Views/Forum.aspx) this is causing a problem.
Fortunately, the YAF Framework provides an extension point we can use to fix the problem yaf.IUrlBuilder. This is a simple interface which takes the query string parameters and returns the appropriate link.
Unfortunately, YAF doesn’t allow you to set the link builder via configuration – it has to be done programmatically. So you’ll need to amend ‘/Forum/UI/Views/Forum.aspx’ to ensure it’s set:
Another possible workaround is to investigate the UrlRewriting….but this look too involved for the time available.