MDL-33022 mod_form: set correct groupid when editing an existing post
authorDan Marsden <dan@danmarsden.com>
Wed, 16 May 2012 00:04:55 +0000 (12:04 +1200)
committerDan Poltawski <dan@moodle.com>
Thu, 2 Aug 2012 02:47:39 +0000 (10:47 +0800)
mod/forum/post.php

index 1162e6a..f2422e5 100644 (file)
@@ -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));
         }