Permalink
Browse files

MDL-24258 (updated): eliminate student capability to delete their pos…

…t when it exceeded the max editing time.
  • Loading branch information...
1 parent 09d40d6 commit b855512a7c3b54b88cb249e6985643cb89a2f892 @rwijaya rwijaya committed Sep 23, 2010
Showing with 7 additions and 7 deletions.
  1. +7 −7 mod/forum/post.php
View
@@ -304,7 +304,13 @@
$replycount = forum_count_replies($post);
if (!empty($confirm) && confirm_sesskey()) { // User has confirmed the delete
-
+ //check user capability to delete post.
+ $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 ($post->totalscore) {
notice(get_string('couldnotdeleteratings', 'rating'),
forum_go_back_to("discuss.php?d=$post->discussion"));
@@ -354,12 +360,6 @@
$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 b855512

Please sign in to comment.