Skip to content

Commit

Permalink
forum MDL-20737 Fixed bug causing exception in forum move to drop down
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Nov 4, 2009
1 parent 7eef78d commit ecf922b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mod/forum/discuss.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,19 @@
}
}
if (!empty($forummenu)) {

// Check for empty groups... This can occur if there is the forum we are in is
// the only forum within its course section.
foreach ($forummenu as $key=>$item) {
// If this option is a group and the next option is a group OR it is
// the last item in the array then remove it... or we get an exception
if (strpos($item, '--------------')===0 && (!array_key_exists($key+1, $forummenu) || strpos($forummenu[$key+1], '--------------')===0)) {
// Remember foreach acts on a copy of the array so things
// will not get out of order
unset($forummenu[$key]);
}
}

echo "<div style=\"float:right;\">";
$select = html_select::make_popup_form('', '', $forummenu, 'forummenu');
$select->nothinglabel = get_string("movethisdiscussionto", "forum");
Expand Down

0 comments on commit ecf922b

Please sign in to comment.