diff --git a/docs/changelog/5.x.x.txt b/docs/changelog/5.x.x.txt index 3881e9af9..590f646df 100644 --- a/docs/changelog/5.x.x.txt +++ b/docs/changelog/5.x.x.txt @@ -1,3 +1,8 @@ +5.5.2 + - Fixed a bug introduced in the last version that only occurs if there was + one forum in a message board. + + 5.5.1 - Fixed bug #829806 preventing users from updating thier passwords from the updateAccount form. - Added Apache 2 instructions to install.txt. (Thanks to Andy Grundman.) diff --git a/lib/WebGUI/Wobject/MessageBoard.pm b/lib/WebGUI/Wobject/MessageBoard.pm index 4ee994cf0..c99c7d85c 100644 --- a/lib/WebGUI/Wobject/MessageBoard.pm +++ b/lib/WebGUI/Wobject/MessageBoard.pm @@ -165,17 +165,22 @@ sub www_moveForumUp { #------------------------------------------------------------------- sub www_view { my $callback = WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")); + if ($session{form}{forumId} eq "" || $session{form}{forumId} eq "new") { + ($session{form}{forumId}) = WebGUI::SQL->quickArray("select forumId from MessageBoard_forums + where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); + } + my ($forumId, $title, $description) = WebGUI::SQL->quickArray("select forumId, title, description from MessageBoard_forums + where wobjectId=".$_[0]->get("wobjectId")." and forumId=".$session{form}{forumId}); + my $forumParam = "forumId=".$forumId; + $callback = WebGUI::URL::append($callback,$forumParam); + my $caller = { + callback=>$callback, + title=>$title, + description=>$description, + forumId=>$forumId + }; if ($session{form}{forumOp}) { - my ($forumId, $title, $description) = WebGUI::SQL->quickArray("select forumId, title, description from MessageBoard_forums - where wobjectId=".$_[0]->get("wobjectId")." and forumId=".$session{form}{forumId}); - my $forumParam = "forumId=".$forumId; - $callback = WebGUI::URL::append($callback,$forumParam); - return WebGUI::Forum::UI::forumOp({ - callback=>$callback, - title=>$title, - description=>$description, - forumId=>$forumId - }); + return WebGUI::Forum::UI::forumOp($caller); } my %var; $var{title} = $_[0]->get("title"); @@ -194,7 +199,7 @@ sub www_view { while (my $forumMeta = $sth->hashRef) { my $forum = WebGUI::Forum->new($forumMeta->{forumId}); if ($count == 1) { - $var{'default.listing'} = WebGUI::Forum::UI::www_viewForum($callback,$forumMeta->{forumId}); + $var{'default.listing'} = WebGUI::Forum::UI::www_viewForum($caller,$forumMeta->{forumId}); $var{'default.description'} = $forumMeta->{description}; $var{'default.title'} = $forumMeta->{title}; $var{'default.controls'} = $_[0]->_formatControls($forum->get("forumId"));