Skip to content

Commit

Permalink
MDL-24258: eliminate student capability to delete their post when it …
Browse files Browse the repository at this point in the history
…exceeded the max editing time.
  • Loading branch information
rwijaya committed Sep 23, 2010
1 parent b02ed89 commit c927eb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions lang/en_utf8/forum.php
Expand Up @@ -31,6 +31,7 @@
$string['cannotviewpostyet'] = 'You cannot read other students questions in this discussion yet because you haven\'t posted';
$string['cannotadddiscussion'] = 'Adding discussions to this forum requires group membership.';
$string['cannotadddiscussionall'] = 'You do not have permission to add a new discussion topic for all participants.';
$string['cannotdeletepost'] = 'You can\'t delete this post!';
$string['cleanreadtime'] = 'Mark old posts as read hour';
$string['configajaxrating'] = 'AJAX rating is a forum rating usability improvement. If enabled, users can rate forum posts almost instantly without needing to scroll to the bottom of the page and click the \'Send in my latest ratings\' button. This setting also requires AJAX to be enabled for the site and in user profiles.';
$string['configcleanreadtime'] = 'The hour of the day to clean old posts from the \'read\' table.';
Expand Down
10 changes: 8 additions & 2 deletions mod/forum/post.php
Expand Up @@ -265,9 +265,15 @@


$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", "forum"),
forum_go_back_to("discuss.php?d=$post->discussion"));
Expand Down

0 comments on commit c927eb4

Please sign in to comment.