diff --git a/mod/forum/classes/post_form.php b/mod/forum/classes/post_form.php index 1e76e93edf5..01a10bf4724 100644 --- a/mod/forum/classes/post_form.php +++ b/mod/forum/classes/post_form.php @@ -201,7 +201,7 @@ class mod_forum_post_form extends moodleform { } else { $submit_string = get_string('posttoforum', 'forum'); } - $this->add_action_buttons(false, $submit_string); + $this->add_action_buttons(true, $submit_string); $mform->addElement('hidden', 'course'); $mform->setType('course', PARAM_INT); diff --git a/mod/forum/post.php b/mod/forum/post.php index b1bdd9ff929..e53136e9140 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -655,7 +655,14 @@ $mform_post->set_data(array( 'attachments'=>$draftitemid, array('discussion'=>$discussion->id): array())); -if ($fromform = $mform_post->get_data()) { +if ($mform_post->is_cancelled()) { + if (!isset($discussion->id) || $forum->type === 'qanda') { + // Q and A forums don't have a discussion page, so treat them like a new thread.. + redirect(new moodle_url('/mod/forum/view.php', array('f' => $forum->id))); + } else { + redirect(new moodle_url('/mod/forum/discuss.php', array('d' => $discussion->id))); + } +} else if ($fromform = $mform_post->get_data()) { if (empty($SESSION->fromurl)) { $errordestination = "$CFG->wwwroot/mod/forum/view.php?f=$forum->id";