Browse Source

Added Feature - Cutoff for deletion of threads by OP if they have a certain number of replies.

main
PupperWoff 7 years ago
committed by discomrade
parent
commit
16c4f2719a
  1. 3
      inc/config.php
  2. 8
      post.php

3
inc/config.php

@ -524,6 +524,8 @@
// Allow users to delete their own posts?
$config['allow_delete'] = true;
// If thread has at least this number of replies, OP can't delete it anymore. (Set to false to disable)
$config['allow_delete_cutoff'] = 10;
// How long after posting should you have to wait before being able to delete that post? (In seconds.)
$config['delete_time'] = 10;
// Reply limit (stops bumping thread when this is reached).
@ -1232,6 +1234,7 @@
$config['error']['fileexistsinthread'] = _('That file <a href="%s">already exists</a> in this thread!');
$config['error']['delete_too_soon'] = _('You\'ll have to wait another %s before deleting that.');
$config['error']['delete_post_cutoff'] = _('You can\'t delete a post with this many replies.');
$config['error']['mime_exploit'] = _('MIME type detection XSS exploit (IE) detected; post discarded.');
$config['error']['invalid_embed'] = _('Couldn\'t make sense of the URL of the video you tried to embed.');
$config['error']['captcha'] = _('You seem to have mistyped the verification.');

8
post.php

@ -239,6 +239,14 @@ if (isset($_POST['delete'])) {
deleteFile($id);
modLog("User deleted file from his own post #$id");
} else {
// Check if thread, and that the delete cutoff post count hasn't been reached
if($config['allow_delete_cutoff'] && $post['thread'] === NULL) {
$count_query = query(sprintf("SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = %d", $board['uri'], (int)$id));
if($count_query->fetchColumn(0) >= $config['allow_delete_cutoff'])
error($config['error']['delete_post_cutoff']);
}
// Delete entire post
deletePost($id);
modLog("User deleted his own post #$id");

Loading…
Cancel
Save