Skip to content

Commit

Permalink
MDL-24258 (updated): eliminate student capability to delete their pos…
Browse files Browse the repository at this point in the history
…t when it exceeded the max editing time.
  • Loading branch information
rwijaya committed Sep 23, 2010
1 parent 09d40d6 commit b855512
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions mod/forum/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit b855512

Please sign in to comment.