diff --git a/mod/forum/post.php b/mod/forum/post.php index 1162e6aea95..f2422e5c95b 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -627,6 +627,9 @@ if ($fromform = $mform_post->get_data()) { // If the user has access to all groups and they are changing the group, then update the post. if ($contextcheck) { + if (empty($fromform->groupinfo)) { + $fromform->groupinfo = -1; + } $DB->set_field('forum_discussions' ,'groupid' , $fromform->groupinfo, array('firstpost' => $fromform->id)); }