Skip to content
Browse files

MDL-24258: eliminate student capability to delete their post when it …

…exceeded the max editing time.
  • Loading branch information...
1 parent 60a1a25 commit 09d40d652df617223134798b136063e299acaeb1 Rossiani Wijaya committed
Showing with 7 additions and 0 deletions.
  1. +7 −0 mod/forum/post.php
View
7 mod/forum/post.php
@@ -353,6 +353,13 @@
$PAGE->navbar->add(get_string('delete', 'forum'));
$PAGE->set_title($course->shortname);
$PAGE->set_heading($course->fullname);
+
+ $timepassed = time() - $post->created;
+ if (($timepassed > $CFG->maxeditingtime) && !has_capability('mod/forum:deleteanypost', $modcontext)) {
+ print_error("cannotdeletepost", "forum",
+ forum_go_back_to("discuss.php?d=$post->discussion"));
+ }
+
if ($replycount) {
if (!has_capability('mod/forum:deleteanypost', $modcontext)) {
print_error("couldnotdeletereplies", "forum",

0 comments on commit 09d40d6

Please sign in to comment.
Something went wrong with that request. Please try again.