Skip to content

Commit

Permalink
Merge pull request #1155 from johnhenley/issues/group-url-1152
Browse files Browse the repository at this point in the history
FIX: Filter forum view if group specified on query string
  • Loading branch information
johnhenley authored Nov 7, 2024
2 parents 4eee3fd + d811843 commit ecf002a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Dnn.CommunityForums/CustomControls/UserControls/ForumView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ public string BuildForumView()
{
HttpContext.Current.Items.Add("ShowToolbar", false);
}

stringBuilder.Replace("[NOTOOLBAR]", string.Empty);
}

sTemplate = stringBuilder.ToString();

if (sTemplate.Contains("[FORUMS]"))
Expand Down Expand Up @@ -219,7 +221,14 @@ public string BuildForumView()
}
}

this.Forums = this.Forums.OrderBy(f => f.ForumGroup?.SortOrder).ThenBy(f => f.SortOrder).ToList();
if (this.Request.QueryString[ParamKeys.GroupId] != null)
{
this.Forums = this.Forums.Where(f => f.ForumGroupId == Convert.ToInt32(this.Request.QueryString[ParamKeys.GroupId])).OrderBy(f => f.ForumGroup?.SortOrder).ThenBy(f => f.SortOrder).ToList();
}
else
{
this.Forums = this.Forums.OrderBy(f => f.ForumGroup?.SortOrder).ThenBy(f => f.SortOrder).ToList();
}

string sGroupName = (this.ForumGroupId != -1 && this.Forums?.Count > 0) ? this.Forums?.FirstOrDefault().GroupName : string.Empty;
string sCrumb = (this.ForumGroupId != -1 && this.Forums?.Count > 0) ? "<div class=\"afcrumb\"><i class=\"fa fa-comments-o fa-grey\"></i> <a href=\"" + Utilities.NavigateURL(this.TabId) + "\">[RESX:ForumMain]</a> <i class=\"fa fa-long-arrow-right fa-grey\"></i> " + sGroupName + "</div>" : string.Empty;
Expand Down

0 comments on commit ecf002a

Please sign in to comment.