Permalink
Browse files

MDL-39192 mod_forum: do not need to check the posting threshold when …

…editing a post
  • Loading branch information...
1 parent 14559e1 commit eaa8f5ad539911a4e72c031ec074054e662118df @markn86 markn86 committed Apr 24, 2013
Showing with 9 additions and 3 deletions.
  1. +5 −2 mod/forum/post.php
  2. +4 −1 mod/forum/post_form.php
View
@@ -514,7 +514,8 @@
'modcontext' => $modcontext,
'forum' => $forum,
'post' => $post,
- 'thresholdwarning' => $thresholdwarning), 'post', '', array('id' => 'mformforum'));
+ 'thresholdwarning' => $thresholdwarning,
+ 'edit' => $edit), 'post', '', array('id' => 'mformforum'));
$draftitemid = file_get_submitted_draft_itemid('attachments');
file_prepare_draft_area($draftitemid, $modcontext->id, 'mod_forum', 'attachment', empty($post->id)?null:$post->id, mod_forum_post_form::attachment_options($forum));
@@ -871,7 +872,9 @@
echo $OUTPUT->notification(get_string('qandanotify','forum'));
}
-if (!empty($thresholdwarning)) {
+// If there is a warning message and we are not editing a post we need to handle the warning.
+if (!empty($thresholdwarning) && !$edit) {
+ // Here we want to throw an exception if they are no longer allowed to post.
if (!$thresholdwarning->canpost) {
print_error($thresholdwarning->errorcode, $thresholdwarning->module, $thresholdwarning->link,
$thresholdwarning->additional);
@@ -75,11 +75,14 @@ function definition() {
$modcontext = $this->_customdata['modcontext'];
$forum = $this->_customdata['forum'];
$post = $this->_customdata['post'];
+ $edit = $this->_customdata['edit'];
$thresholdwarning = $this->_customdata['thresholdwarning'];
$mform->addElement('header', 'general', '');//fill in the data depending on page params later using set_data
- if (!empty($thresholdwarning)) {
+ // If there is a warning message and we are not editing a post we need to handle the warning.
+ if (!empty($thresholdwarning) && !$edit) {
+ // Here we want to display a warning if they can still post but have reached the warning threshold.
if ($thresholdwarning->canpost) {
$message = get_string($thresholdwarning->errorcode, $thresholdwarning->module, $thresholdwarning->additional);
$mform->addElement('html', $OUTPUT->notification($message));

0 comments on commit eaa8f5a

Please sign in to comment.