Disable Comments - Version 2.4.2

Version Description

Download this release

Release Info

Developer wpdevteam
Plugin Icon 128x128 Disable Comments
Version 2.4.2
Comparing to
See all releases

Code changes from version 2.4.1 to 2.4.2

disable-comments.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Disable Comments
5
  * Plugin URI: https://wordpress.org/plugins/disable-comments/
6
  * Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. You could bulk delete comments using Tools.
7
- * Version: 2.4.1
8
  * Author: WPDeveloper
9
  * Author URI: https://wpdeveloper.com
10
  * License: GPL-3.0+
@@ -37,7 +37,7 @@ class Disable_Comments
37
 
38
  function __construct()
39
  {
40
- define('DC_VERSION', '2.4.1');
41
  define('DC_PLUGIN_SLUG', 'disable_comments_settings');
42
  define('DC_PLUGIN_ROOT_PATH', dirname(__FILE__));
43
  define('DC_PLUGIN_VIEWS_PATH', DC_PLUGIN_ROOT_PATH . '/views/');
@@ -1131,9 +1131,9 @@ class Disable_Comments
1131
  if (!empty($delete_post_types)) {
1132
  // Loop through post_types and remove comments/meta and set posts comment_count to 0.
1133
  foreach ($delete_post_types as $delete_post_type) {
1134
- $wpdb->query("DELETE cmeta FROM $wpdb->commentmeta cmeta INNER JOIN $wpdb->comments comments ON cmeta.comment_id=comments.comment_ID INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '$delete_post_type'");
1135
- $wpdb->query("DELETE comments FROM $wpdb->comments comments INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '$delete_post_type'");
1136
- $wpdb->query("UPDATE $wpdb->posts SET comment_count = 0 WHERE post_author != 0 AND post_type = '$delete_post_type'");
1137
 
1138
  $post_type_object = get_post_type_object($delete_post_type);
1139
  $post_type_label = $post_type_object ? $post_type_object->labels->name : $delete_post_type;
@@ -1151,15 +1151,15 @@ class Disable_Comments
1151
  if (!empty($delete_comment_types)) {
1152
  // Loop through comment_types and remove comments/meta and set posts comment_count to 0.
1153
  foreach ($delete_comment_types as $delete_comment_type) {
1154
- $wpdb->query("DELETE cmeta FROM $wpdb->commentmeta cmeta INNER JOIN $wpdb->comments comments ON cmeta.comment_id=comments.comment_ID WHERE comments.comment_type = '$delete_comment_type'");
1155
- $wpdb->query("DELETE comments FROM $wpdb->comments comments WHERE comments.comment_type = '$delete_comment_type'");
1156
  $deletedPostTypeNames[] = $commenttypes[$delete_comment_type];
1157
  }
1158
 
1159
  // Update comment_count on post_types
1160
  foreach ($types as $key => $value) {
1161
- $comment_count = $wpdb->get_var("SELECT COUNT(comments.comment_ID) FROM $wpdb->comments comments INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '$key'");
1162
- $wpdb->query("UPDATE $wpdb->posts SET comment_count = $comment_count WHERE post_author != 0 AND post_type = '$key'");
1163
  }
1164
 
1165
  $wpdb->query("OPTIMIZE TABLE $wpdb->commentmeta");
4
  * Plugin Name: Disable Comments
5
  * Plugin URI: https://wordpress.org/plugins/disable-comments/
6
  * Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. You could bulk delete comments using Tools.
7
+ * Version: 2.4.2
8
  * Author: WPDeveloper
9
  * Author URI: https://wpdeveloper.com
10
  * License: GPL-3.0+
37
 
38
  function __construct()
39
  {
40
+ define('DC_VERSION', '2.4.2');
41
  define('DC_PLUGIN_SLUG', 'disable_comments_settings');
42
  define('DC_PLUGIN_ROOT_PATH', dirname(__FILE__));
43
  define('DC_PLUGIN_VIEWS_PATH', DC_PLUGIN_ROOT_PATH . '/views/');
1131
  if (!empty($delete_post_types)) {
1132
  // Loop through post_types and remove comments/meta and set posts comment_count to 0.
1133
  foreach ($delete_post_types as $delete_post_type) {
1134
+ $wpdb->query($wpdb->prepare("DELETE cmeta FROM $wpdb->commentmeta cmeta INNER JOIN $wpdb->comments comments ON cmeta.comment_id=comments.comment_ID INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '%s'", $delete_post_type));
1135
+ $wpdb->query($wpdb->prepare("DELETE comments FROM $wpdb->comments comments INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '%s'", $delete_post_type));
1136
+ $wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET comment_count = 0 WHERE post_author != 0 AND post_type = '%s'", $delete_post_type));
1137
 
1138
  $post_type_object = get_post_type_object($delete_post_type);
1139
  $post_type_label = $post_type_object ? $post_type_object->labels->name : $delete_post_type;
1151
  if (!empty($delete_comment_types)) {
1152
  // Loop through comment_types and remove comments/meta and set posts comment_count to 0.
1153
  foreach ($delete_comment_types as $delete_comment_type) {
1154
+ $wpdb->query($wpdb->prepare("DELETE cmeta FROM $wpdb->commentmeta cmeta INNER JOIN $wpdb->comments comments ON cmeta.comment_id=comments.comment_ID WHERE comments.comment_type = '%s'", $delete_comment_type));
1155
+ $wpdb->query($wpdb->prepare("DELETE comments FROM $wpdb->comments comments WHERE comments.comment_type = '%s'", $delete_comment_type));
1156
  $deletedPostTypeNames[] = $commenttypes[$delete_comment_type];
1157
  }
1158
 
1159
  // Update comment_count on post_types
1160
  foreach ($types as $key => $value) {
1161
+ $comment_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(comments.comment_ID) FROM $wpdb->comments comments INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '%s'", $key));
1162
+ $wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET comment_count = %d WHERE post_author != 0 AND post_type = '%s'", $comment_count, $key));
1163
  }
1164
 
1165
  $wpdb->query("OPTIMIZE TABLE $wpdb->commentmeta");
languages/disable-comments.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL-3.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Disable Comments 2.4.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/disable-comments\n"
7
- "POT-Creation-Date: 2022-08-10 06:24:31+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
2
  # This file is distributed under the GPL-3.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Disable Comments 2.4.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/disable-comments\n"
7
+ "POT-Creation-Date: 2022-09-18 08:08:32+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Disable Comments - Remove Comments & Stop Spam [Multi-Site Support] ===
2
- Contributors: Asif2BD, priyomukul, wpdevteam, re_enter_rupok, tusharimran, alimuzzamanalim, solarissmoke, garrett-eclipse
3
  Donate link: https://wpdeveloper.com/
4
  Tags: comments, delete comments, disable comments, spam comment, disable, stop spam, remove comments, anti spam, disable xml-rpc, hide comment, XML-RPC, REST-API, WP-CLI, multi-site support
5
  Requires at least: 5.0
6
- Tested up to: 6.0
7
  Requires PHP: 5.6
8
- Stable tag: 2.4.1
9
  License: GPL-3.0-or-later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -45,7 +45,7 @@ https://www.youtube.com/watch?v=J9AteKzQpPs
45
  * **[New]** Delete comments by type.
46
  * **[New]** Disable comments via [XML-RPC](https://wpdeveloper.com/docs/how-to-disable-comments-made-via-xml-rpc/) & [REST-API](https://wpdeveloper.com/docs/how-to-disable-comments-made-via-rest-api/)
47
  * **[New]** Fully Multi-site Network supported.
48
- * **[New]** Manage multiple website networks specific subsites or entire networks comments in advance.
49
  * **[New]** Exclude Disable Comments Settings based on user roles.
50
 
51
  https://www.youtube.com/watch?v=FBq3-W-p-DM
@@ -194,6 +194,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
194
  and this project adheres to [Semantic Versioning](http://semver.org/).
195
  This will be maiintained from August 19, 2020 - @asif2bd
196
 
 
 
 
197
  = [2.4.1] - 2022-08-10 =
198
  * Improvement: Localized missing strings in plugin.
199
  * Improvement: Included the fonts in plugin distribution.
1
  === Disable Comments - Remove Comments & Stop Spam [Multi-Site Support] ===
2
+ Contributors: Asif2BD, priyomukul, wpdevteam, re_enter_rupok, alimuzzamanalim, solarissmoke, garrett-eclipse
3
  Donate link: https://wpdeveloper.com/
4
  Tags: comments, delete comments, disable comments, spam comment, disable, stop spam, remove comments, anti spam, disable xml-rpc, hide comment, XML-RPC, REST-API, WP-CLI, multi-site support
5
  Requires at least: 5.0
6
+ Tested up to: 6.1
7
  Requires PHP: 5.6
8
+ Stable tag: 2.4.2
9
  License: GPL-3.0-or-later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
45
  * **[New]** Delete comments by type.
46
  * **[New]** Disable comments via [XML-RPC](https://wpdeveloper.com/docs/how-to-disable-comments-made-via-xml-rpc/) & [REST-API](https://wpdeveloper.com/docs/how-to-disable-comments-made-via-rest-api/)
47
  * **[New]** Fully Multi-site Network supported.
48
+ * **[New]** Manage multiple website networks specific subsites or entire networks comments in advance.
49
  * **[New]** Exclude Disable Comments Settings based on user roles.
50
 
51
  https://www.youtube.com/watch?v=FBq3-W-p-DM
194
  and this project adheres to [Semantic Versioning](http://semver.org/).
195
  This will be maiintained from August 19, 2020 - @asif2bd
196
 
197
+ = [2.4.2] - 2022-09-18 =
198
+ * Improved sanitization.
199
+
200
  = [2.4.1] - 2022-08-10 =
201
  * Improvement: Localized missing strings in plugin.
202
  * Improvement: Included the fonts in plugin distribution.