diff --git a/mod/forum/db/upgrade.php b/mod/forum/db/upgrade.php index a05a566c099..7b46c1cffa2 100644 --- a/mod/forum/db/upgrade.php +++ b/mod/forum/db/upgrade.php @@ -240,5 +240,13 @@ function xmldb_forum_upgrade($oldversion) { // Moodle v2.8.0 release upgrade line. // Put any upgrade step following this. + if ($oldversion < 2014111002) { + // Groupid = 0 is never valid. + $DB->set_field('forum_discussions', 'groupid', -1, array('groupid' => 0)); + + // Forum savepoint reached. + upgrade_mod_savepoint(true, 2014111002, 'forum'); + } + return true; } diff --git a/mod/forum/post.php b/mod/forum/post.php index 4d94b83fd4c..f723f503b39 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -840,7 +840,7 @@ if ($mform_post->is_cancelled()) { // Before we add this we must check that the user will not exceed the blocking threshold. forum_check_blocking_threshold($thresholdwarning); - if (isset($fromform->groupinfo)) { + if (!empty($fromform->groupinfo)) { // Use the value provided in the dropdown group selection. $fromform->groupid = $fromform->groupinfo; diff --git a/mod/forum/version.php b/mod/forum/version.php index 068039e59ff..83ebd8b24ed 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2014111001; // The current module version (Date: YYYYMMDDXX) +$plugin->version = 2014111002; // The current module version (Date: YYYYMMDDXX) $plugin->requires = 2014110400; // Requires this Moodle version $plugin->component = 'mod_forum'; // Full name of the plugin (used for diagnostics)