MDL-24258 (updated): eliminate student capability to delete their post when it exceeded the max editing time.

This commit is contained in:
Rossiani Wijaya
2010-09-23 08:03:47 +00:00
parent 09d40d652d
commit b855512a7c
+7 -7
View File
@@ -304,7 +304,13 @@ if (!empty($forum)) { // User is starting a new discussion in a forum
$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 @@ if (!empty($forum)) { // User is starting a new discussion in a 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",