Disable Comments - Version 1.10.3

Version Description

Download this release

Release Info

Developer Asif2BD
Plugin Icon 128x128 Disable Comments
Version 1.10.3
Comparing to
See all releases

Code changes from version 1.10.0 to 1.10.3

assets/disable-comments.js CHANGED
@@ -2,11 +2,7 @@
2
 
3
  wp.domReady(function () {
4
  if (wp.blocks) {
5
- wp.blocks.getBlockTypes().forEach(function (block) {
6
- if (disable_comments.disabled_blocks.includes(block.name)) {
7
- wp.blocks.unregisterBlockType(block.name);
8
- }
9
- });
10
  }
11
  });
12
  //# sourceMappingURL=disable-comments.js.map
2
 
3
  wp.domReady(function () {
4
  if (wp.blocks) {
5
+ wp.blocks.unregisterBlockType('core/latest-comments');
 
 
 
 
6
  }
7
  });
8
  //# sourceMappingURL=disable-comments.js.map
assets/disable-comments.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/disable-comments.js"],"names":["wp","domReady","blocks","getBlockTypes","forEach","block","disable_comments","disabled_blocks","includes","name","unregisterBlockType"],"mappings":";;AAAAA,EAAE,CAACC,QAAH,CAAY,YAAM;AACjB,MAAGD,EAAE,CAACE,MAAN,EAAc;AACbF,IAAAA,EAAE,CAACE,MAAH,CAAUC,aAAV,GAA0BC,OAA1B,CAAkC,UAACC,KAAD,EAAW;AAC5C,UAAIC,gBAAgB,CAACC,eAAjB,CAAiCC,QAAjC,CAA0CH,KAAK,CAACI,IAAhD,CAAJ,EAA2D;AAC1DT,QAAAA,EAAE,CAACE,MAAH,CAAUQ,mBAAV,CAA8BL,KAAK,CAACI,IAApC;AACA;AACD,KAJD;AAKA;AACD,CARD","sourcesContent":["wp.domReady(() => {\n\tif(wp.blocks) {\n\t\twp.blocks.getBlockTypes().forEach((block) => {\n\t\t\tif (disable_comments.disabled_blocks.includes(block.name)) {\n\t\t\t\twp.blocks.unregisterBlockType(block.name);\n\t\t\t}\n\t\t});\n\t}\n});\n"],"file":"disable-comments.js"}
1
+ {"version":3,"sources":["../src/disable-comments.js"],"names":["wp","domReady","blocks","unregisterBlockType"],"mappings":";;AAAAA,EAAE,CAACC,QAAH,CAAY,YAAM;AACjB,MAAGD,EAAE,CAACE,MAAN,EAAc;AACbF,IAAAA,EAAE,CAACE,MAAH,CAAUC,mBAAV,CAA8B,sBAA9B;AACA;AACD,CAJD","sourcesContent":["wp.domReady(() => {\n\tif(wp.blocks) {\n\t\twp.blocks.unregisterBlockType('core/latest-comments');\n\t}\n});\n"],"file":"disable-comments.js"}
disable-comments.php CHANGED
@@ -1,15 +1,18 @@
1
  <?php
2
- /*
3
- Plugin Name: Disable Comments
4
- Plugin URI: https://wordpress.org/plugins/disable-comments/
5
- Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type.
6
- Version: 1.10.2
7
- Author: Samir Shah
8
- Author URI: http://www.rayofsolaris.net/
9
- License: GPL2
10
- Text Domain: disable-comments
11
- Domain Path: /languages/
12
- */
 
 
 
13
 
14
  if ( ! defined( 'ABSPATH' ) ) {
15
  exit;
@@ -33,19 +36,19 @@ class Disable_Comments {
33
  // are we network activated?
34
  $this->networkactive = ( is_multisite() && array_key_exists( plugin_basename( __FILE__ ), (array) get_site_option( 'active_sitewide_plugins' ) ) );
35
 
36
- // Load options
37
  if ( $this->networkactive ) {
38
  $this->options = get_site_option( 'disable_comments_options', array() );
39
  } else {
40
  $this->options = get_option( 'disable_comments_options', array() );
41
  }
42
 
43
- // If it looks like first run, check compat
44
  if ( empty( $this->options ) ) {
45
  $this->check_compatibility();
46
  }
47
 
48
- // Upgrade DB if necessary
49
  $this->check_db_upgrades();
50
 
51
  $this->init_filters();
@@ -65,12 +68,12 @@ class Disable_Comments {
65
  $old_ver = isset( $this->options['db_version'] ) ? $this->options['db_version'] : 0;
66
  if ( $old_ver < self::DB_VERSION ) {
67
  if ( $old_ver < 2 ) {
68
- // upgrade options from version 0.2.1 or earlier to 0.3
69
  $this->options['disabled_post_types'] = get_option( 'disable_comments_post_types', array() );
70
  delete_option( 'disable_comments_post_types' );
71
  }
72
  if ( $old_ver < 5 ) {
73
- // simple is beautiful - remove multiple settings in favour of one
74
  $this->options['remove_everywhere'] = isset( $this->options['remove_admin_menu_comments'] ) ? $this->options['remove_admin_menu_comments'] : false;
75
  foreach ( array( 'remove_admin_menu_comments', 'remove_admin_bar_comments', 'remove_recent_comments', 'remove_discussion', 'remove_rc_widget' ) as $v ) {
76
  unset( $this->options[ $v ] );
@@ -96,12 +99,12 @@ class Disable_Comments {
96
  }
97
  }
98
 
99
- /*
100
  * Get an array of disabled post type.
101
  */
102
  private function get_disabled_post_types() {
103
  $types = $this->options['disabled_post_types'];
104
- // Not all extra_post_types might be registered on this particular site
105
  if ( $this->networkactive ) {
106
  foreach ( (array) $this->options['extra_post_types'] as $extra ) {
107
  if ( post_type_exists( $extra ) ) {
@@ -112,7 +115,7 @@ class Disable_Comments {
112
  return $types;
113
  }
114
 
115
- /*
116
  * Check whether comments have been disabled on a given post type.
117
  */
118
  private function is_post_type_disabled( $type ) {
@@ -120,22 +123,24 @@ class Disable_Comments {
120
  }
121
 
122
  private function init_filters() {
123
- // These need to happen now
124
  if ( $this->options['remove_everywhere'] ) {
125
  add_action( 'widgets_init', array( $this, 'disable_rc_widget' ) );
126
  add_filter( 'wp_headers', array( $this, 'filter_wp_headers' ) );
127
- add_action( 'template_redirect', array( $this, 'filter_query' ), 9 ); // before redirect_canonical
128
 
129
- // Admin bar filtering has to happen here since WP 3.6
130
  add_action( 'template_redirect', array( $this, 'filter_admin_bar' ) );
131
  add_action( 'admin_init', array( $this, 'filter_admin_bar' ) );
 
 
 
132
  }
133
 
134
- // These can happen later
135
  add_action( 'plugins_loaded', array( $this, 'register_text_domain' ) );
136
  add_action( 'wp_loaded', array( $this, 'init_wploaded_filters' ) );
137
-
138
- // Disable "Latest comments" block in Gutenberg
139
  add_action( 'enqueue_block_editor_assets', array( $this, 'filter_gutenberg_blocks') );
140
  }
141
 
@@ -147,7 +152,7 @@ class Disable_Comments {
147
  $disabled_post_types = $this->get_disabled_post_types();
148
  if ( ! empty( $disabled_post_types ) ) {
149
  foreach ( $disabled_post_types as $type ) {
150
- // we need to know what native support was for later
151
  if ( post_type_supports( $type, 'comments' ) ) {
152
  $this->modified_types[] = $type;
153
  remove_post_type_support( $type, 'comments' );
@@ -159,14 +164,16 @@ class Disable_Comments {
159
  add_filter( 'pings_open', array( $this, 'filter_comment_status' ), 20, 2 );
160
  add_filter( 'get_comments_number', array( $this, 'filter_comments_number' ), 20, 2 );
161
  } elseif ( is_admin() && ! $this->options['remove_everywhere'] ) {
162
- // It is possible that $disabled_post_types is empty if other
163
- // plugins have disabled comments. Hence we also check for
164
- // remove_everywhere. If you still get a warning you probably
165
- // shouldn't be using this plugin.
 
 
166
  add_action( 'all_admin_notices', array( $this, 'setup_notice' ) );
167
  }
168
 
169
- // Filters for the admin only
170
  if ( is_admin() ) {
171
  if ( $this->networkactive ) {
172
  add_action( 'network_admin_menu', array( $this, 'settings_menu' ) );
@@ -185,14 +192,14 @@ class Disable_Comments {
185
  add_filter( 'plugin_row_meta', array( $this, 'set_plugin_meta' ), 10, 2 );
186
 
187
  if ( $this->options['remove_everywhere'] ) {
188
- add_action( 'admin_menu', array( $this, 'filter_admin_menu' ), 9999 ); // do this as late as possible
189
  add_action( 'admin_print_styles-index.php', array( $this, 'admin_css' ) );
190
  add_action( 'admin_print_styles-profile.php', array( $this, 'admin_css' ) );
191
  add_action( 'wp_dashboard_setup', array( $this, 'filter_dashboard' ) );
192
  add_filter( 'pre_option_default_pingback_flag', '__return_zero' );
193
  }
194
  }
195
- // Filters for front end only
196
  else {
197
  add_action( 'template_redirect', array( $this, 'check_comment_template' ) );
198
 
@@ -202,7 +209,7 @@ class Disable_Comments {
202
  }
203
  }
204
 
205
- /*
206
  * Replace the theme's comment template with a blank one.
207
  * To prevent this, define DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE
208
  * and set it to True
@@ -213,9 +220,9 @@ class Disable_Comments {
213
  // Kill the comments template.
214
  add_filter( 'comments_template', array( $this, 'dummy_comments_template' ), 20 );
215
  }
216
- // Remove comment-reply script for themes that include it indiscriminately
217
  wp_deregister_script( 'comment-reply' );
218
- // feed_links_extra inserts a comments RSS link
219
  remove_action( 'wp_head', 'feed_links_extra', 3 );
220
  }
221
  }
@@ -225,7 +232,7 @@ class Disable_Comments {
225
  }
226
 
227
 
228
- /*
229
  * Remove the X-Pingback HTTP header
230
  */
231
  public function filter_wp_headers( $headers ) {
@@ -233,21 +240,21 @@ class Disable_Comments {
233
  return $headers;
234
  }
235
 
236
- /*
237
  * Issue a 403 for all comment feed requests.
238
  */
239
  public function filter_query() {
240
  if ( is_comment_feed() ) {
241
- wp_die( __( 'Comments are closed.' ), '', array( 'response' => 403 ) );
242
  }
243
  }
244
 
245
- /*
246
  * Remove comment links from the admin bar.
247
  */
248
  public function filter_admin_bar() {
249
  if ( is_admin_bar_showing() ) {
250
- // Remove comments links from admin bar
251
  remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
252
  if ( is_multisite() ) {
253
  add_action( 'admin_bar_menu', array( $this, 'remove_network_comment_links' ), 500 );
@@ -255,6 +262,14 @@ class Disable_Comments {
255
  }
256
  }
257
 
 
 
 
 
 
 
 
 
258
  /**
259
  * Determines if scripts should be enqueued
260
  */
@@ -271,16 +286,9 @@ class Disable_Comments {
271
  */
272
  public function disable_comments_script() {
273
  wp_enqueue_script( 'disable-comments-gutenberg', plugin_dir_url( __FILE__ ) . 'assets/disable-comments.js', array(), false, true );
274
- wp_localize_script(
275
- 'disable-comments-gutenberg',
276
- 'disable_comments',
277
- array(
278
- 'disabled_blocks' => array( 'core/latest-comments' ),
279
- )
280
- );
281
  }
282
 
283
- /*
284
  * Remove comment links from the admin bar in a multisite network.
285
  */
286
  public function remove_network_comment_links( $wp_admin_bar ) {
@@ -289,7 +297,7 @@ class Disable_Comments {
289
  $wp_admin_bar->remove_menu( 'blog-' . $blog->userblog_id . '-c' );
290
  }
291
  } else {
292
- // We have no way to know whether the plugin is active on other sites, so only remove this one
293
  $wp_admin_bar->remove_menu( 'blog-' . get_current_blog_id() . '-c' );
294
  }
295
  }
@@ -302,7 +310,7 @@ class Disable_Comments {
302
  $names[ $type ] = get_post_type_object( $type )->labels->name;
303
  }
304
 
305
- echo '<div class="notice notice-warning"><p>' . sprintf( __( 'Note: The <em>Disable Comments</em> plugin is currently active, and comments are completely disabled on: %s. Many of the settings below will not be applicable for those post types.', 'disable-comments' ), implode( __( ', ' ), $names ) ) . '</p></div>';
306
  }
307
  }
308
 
@@ -336,14 +344,14 @@ class Disable_Comments {
336
  global $pagenow;
337
 
338
  if ( $pagenow == 'comment.php' || $pagenow == 'edit-comments.php' ) {
339
- wp_die( __( 'Comments are closed.' ), '', array( 'response' => 403 ) );
340
  }
341
 
342
  remove_menu_page( 'edit-comments.php' );
343
 
344
  if ( ! $this->discussion_settings_allowed() ) {
345
  if ( $pagenow == 'options-discussion.php' ) {
346
- wp_die( __( 'Comments are closed.' ), '', array( 'response' => 403 ) );
347
  }
348
 
349
  remove_submenu_page( 'options-general.php', 'options-discussion.php' );
@@ -383,8 +391,10 @@ class Disable_Comments {
383
 
384
  public function disable_rc_widget() {
385
  unregister_widget( 'WP_Widget_Recent_Comments' );
386
- // The widget has added a style action when it was constructed - which will
387
- // still fire even if we now unregister the widget... so filter that out
 
 
388
  add_filter( 'show_recent_comments_widget_style', '__return_false' );
389
  }
390
 
@@ -392,7 +402,7 @@ class Disable_Comments {
392
  static $plugin;
393
  $plugin = plugin_basename( __FILE__ );
394
  if ( $file == $plugin ) {
395
- $links[] = '<a href="https://github.com/solarissmoke/disable-comments">GitHub</a>';
396
  }
397
  return $links;
398
  }
@@ -406,8 +416,8 @@ class Disable_Comments {
406
  if ( $file == $plugin && current_user_can( 'manage_options' ) ) {
407
  array_unshift(
408
  $links,
409
- sprintf( '<a href="%s">%s</a>', esc_attr( $this->settings_page_url() ), __( 'Settings' ) ),
410
- sprintf( '<a href="%s">%s</a>', esc_attr( $this->tools_page_url() ), __( 'Tools' ) )
411
  );
412
  }
413
 
@@ -447,7 +457,7 @@ class Disable_Comments {
447
  }
448
 
449
  public function single_site_deactivate() {
450
- // for single sites, delete the options upon deactivation, not uninstall
451
  delete_option( 'disable_comments_options' );
452
  }
453
  }
1
  <?php
2
+ /**
3
+ * Plugin Name: Disable Comments
4
+ * Plugin URI: https://wordpress.org/plugins/disable-comments/
5
+ * Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type.
6
+ * Version: 1.10.3
7
+ * Author: WPDeveloper
8
+ * Author URI: https://wpdeveloper.net
9
+ * License: GPL-3.0+
10
+ * License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
+ * Text Domain: disable-comments
12
+ * Domain Path: /languages/
13
+ *
14
+ * @package Disable_Comments
15
+ */
16
 
17
  if ( ! defined( 'ABSPATH' ) ) {
18
  exit;
36
  // are we network activated?
37
  $this->networkactive = ( is_multisite() && array_key_exists( plugin_basename( __FILE__ ), (array) get_site_option( 'active_sitewide_plugins' ) ) );
38
 
39
+ // Load options.
40
  if ( $this->networkactive ) {
41
  $this->options = get_site_option( 'disable_comments_options', array() );
42
  } else {
43
  $this->options = get_option( 'disable_comments_options', array() );
44
  }
45
 
46
+ // If it looks like first run, check compat.
47
  if ( empty( $this->options ) ) {
48
  $this->check_compatibility();
49
  }
50
 
51
+ // Upgrade DB if necessary.
52
  $this->check_db_upgrades();
53
 
54
  $this->init_filters();
68
  $old_ver = isset( $this->options['db_version'] ) ? $this->options['db_version'] : 0;
69
  if ( $old_ver < self::DB_VERSION ) {
70
  if ( $old_ver < 2 ) {
71
+ // upgrade options from version 0.2.1 or earlier to 0.3.
72
  $this->options['disabled_post_types'] = get_option( 'disable_comments_post_types', array() );
73
  delete_option( 'disable_comments_post_types' );
74
  }
75
  if ( $old_ver < 5 ) {
76
+ // simple is beautiful - remove multiple settings in favour of one.
77
  $this->options['remove_everywhere'] = isset( $this->options['remove_admin_menu_comments'] ) ? $this->options['remove_admin_menu_comments'] : false;
78
  foreach ( array( 'remove_admin_menu_comments', 'remove_admin_bar_comments', 'remove_recent_comments', 'remove_discussion', 'remove_rc_widget' ) as $v ) {
79
  unset( $this->options[ $v ] );
99
  }
100
  }
101
 
102
+ /**
103
  * Get an array of disabled post type.
104
  */
105
  private function get_disabled_post_types() {
106
  $types = $this->options['disabled_post_types'];
107
+ // Not all extra_post_types might be registered on this particular site.
108
  if ( $this->networkactive ) {
109
  foreach ( (array) $this->options['extra_post_types'] as $extra ) {
110
  if ( post_type_exists( $extra ) ) {
115
  return $types;
116
  }
117
 
118
+ /**
119
  * Check whether comments have been disabled on a given post type.
120
  */
121
  private function is_post_type_disabled( $type ) {
123
  }
124
 
125
  private function init_filters() {
126
+ // These need to happen now.
127
  if ( $this->options['remove_everywhere'] ) {
128
  add_action( 'widgets_init', array( $this, 'disable_rc_widget' ) );
129
  add_filter( 'wp_headers', array( $this, 'filter_wp_headers' ) );
130
+ add_action( 'template_redirect', array( $this, 'filter_query' ), 9 ); // before redirect_canonical.
131
 
132
+ // Admin bar filtering has to happen here since WP 3.6.
133
  add_action( 'template_redirect', array( $this, 'filter_admin_bar' ) );
134
  add_action( 'admin_init', array( $this, 'filter_admin_bar' ) );
135
+
136
+ // Disable Comments REST API Endpoint
137
+ add_filter( 'rest_endpoints', array( $this, 'filter_rest_endpoints' ) );
138
  }
139
 
140
+ // These can happen later.
141
  add_action( 'plugins_loaded', array( $this, 'register_text_domain' ) );
142
  add_action( 'wp_loaded', array( $this, 'init_wploaded_filters' ) );
143
+ // Disable "Latest comments" block in Gutenberg.
 
144
  add_action( 'enqueue_block_editor_assets', array( $this, 'filter_gutenberg_blocks') );
145
  }
146
 
152
  $disabled_post_types = $this->get_disabled_post_types();
153
  if ( ! empty( $disabled_post_types ) ) {
154
  foreach ( $disabled_post_types as $type ) {
155
+ // we need to know what native support was for later.
156
  if ( post_type_supports( $type, 'comments' ) ) {
157
  $this->modified_types[] = $type;
158
  remove_post_type_support( $type, 'comments' );
164
  add_filter( 'pings_open', array( $this, 'filter_comment_status' ), 20, 2 );
165
  add_filter( 'get_comments_number', array( $this, 'filter_comments_number' ), 20, 2 );
166
  } elseif ( is_admin() && ! $this->options['remove_everywhere'] ) {
167
+ /**
168
+ * It is possible that $disabled_post_types is empty if other
169
+ * plugins have disabled comments. Hence we also check for
170
+ * remove_everywhere. If you still get a warning you probably
171
+ * shouldn't be using this plugin.
172
+ */
173
  add_action( 'all_admin_notices', array( $this, 'setup_notice' ) );
174
  }
175
 
176
+ // Filters for the admin only.
177
  if ( is_admin() ) {
178
  if ( $this->networkactive ) {
179
  add_action( 'network_admin_menu', array( $this, 'settings_menu' ) );
192
  add_filter( 'plugin_row_meta', array( $this, 'set_plugin_meta' ), 10, 2 );
193
 
194
  if ( $this->options['remove_everywhere'] ) {
195
+ add_action( 'admin_menu', array( $this, 'filter_admin_menu' ), 9999 ); // do this as late as possible.
196
  add_action( 'admin_print_styles-index.php', array( $this, 'admin_css' ) );
197
  add_action( 'admin_print_styles-profile.php', array( $this, 'admin_css' ) );
198
  add_action( 'wp_dashboard_setup', array( $this, 'filter_dashboard' ) );
199
  add_filter( 'pre_option_default_pingback_flag', '__return_zero' );
200
  }
201
  }
202
+ // Filters for front end only.
203
  else {
204
  add_action( 'template_redirect', array( $this, 'check_comment_template' ) );
205
 
209
  }
210
  }
211
 
212
+ /**
213
  * Replace the theme's comment template with a blank one.
214
  * To prevent this, define DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE
215
  * and set it to True
220
  // Kill the comments template.
221
  add_filter( 'comments_template', array( $this, 'dummy_comments_template' ), 20 );
222
  }
223
+ // Remove comment-reply script for themes that include it indiscriminately.
224
  wp_deregister_script( 'comment-reply' );
225
+ // feed_links_extra inserts a comments RSS link.
226
  remove_action( 'wp_head', 'feed_links_extra', 3 );
227
  }
228
  }
232
  }
233
 
234
 
235
+ /**
236
  * Remove the X-Pingback HTTP header
237
  */
238
  public function filter_wp_headers( $headers ) {
240
  return $headers;
241
  }
242
 
243
+ /**
244
  * Issue a 403 for all comment feed requests.
245
  */
246
  public function filter_query() {
247
  if ( is_comment_feed() ) {
248
+ wp_die( __( 'Comments are closed.', 'disable-comments' ), '', array( 'response' => 403 ) );
249
  }
250
  }
251
 
252
+ /**
253
  * Remove comment links from the admin bar.
254
  */
255
  public function filter_admin_bar() {
256
  if ( is_admin_bar_showing() ) {
257
+ // Remove comments links from admin bar.
258
  remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
259
  if ( is_multisite() ) {
260
  add_action( 'admin_bar_menu', array( $this, 'remove_network_comment_links' ), 500 );
262
  }
263
  }
264
 
265
+ /**
266
+ * Remove the comments endpoint for the REST API
267
+ */
268
+ public function filter_rest_endpoints( $endpoints ) {
269
+ unset( $endpoints['comments'] );
270
+ return $endpoints;
271
+ }
272
+
273
  /**
274
  * Determines if scripts should be enqueued
275
  */
286
  */
287
  public function disable_comments_script() {
288
  wp_enqueue_script( 'disable-comments-gutenberg', plugin_dir_url( __FILE__ ) . 'assets/disable-comments.js', array(), false, true );
 
 
 
 
 
 
 
289
  }
290
 
291
+ /**
292
  * Remove comment links from the admin bar in a multisite network.
293
  */
294
  public function remove_network_comment_links( $wp_admin_bar ) {
297
  $wp_admin_bar->remove_menu( 'blog-' . $blog->userblog_id . '-c' );
298
  }
299
  } else {
300
+ // We have no way to know whether the plugin is active on other sites, so only remove this one.
301
  $wp_admin_bar->remove_menu( 'blog-' . get_current_blog_id() . '-c' );
302
  }
303
  }
310
  $names[ $type ] = get_post_type_object( $type )->labels->name;
311
  }
312
 
313
+ echo '<div class="notice notice-warning"><p>' . sprintf( __( 'Note: The <em>Disable Comments</em> plugin is currently active, and comments are completely disabled on: %s. Many of the settings below will not be applicable for those post types.', 'disable-comments' ), implode( __( ', ', 'disable-comments' ), $names ) ) . '</p></div>';
314
  }
315
  }
316
 
344
  global $pagenow;
345
 
346
  if ( $pagenow == 'comment.php' || $pagenow == 'edit-comments.php' ) {
347
+ wp_die( __( 'Comments are closed.', 'disable-comments' ), '', array( 'response' => 403 ) );
348
  }
349
 
350
  remove_menu_page( 'edit-comments.php' );
351
 
352
  if ( ! $this->discussion_settings_allowed() ) {
353
  if ( $pagenow == 'options-discussion.php' ) {
354
+ wp_die( __( 'Comments are closed.', 'disable-comments' ), '', array( 'response' => 403 ) );
355
  }
356
 
357
  remove_submenu_page( 'options-general.php', 'options-discussion.php' );
391
 
392
  public function disable_rc_widget() {
393
  unregister_widget( 'WP_Widget_Recent_Comments' );
394
+ /**
395
+ * The widget has added a style action when it was constructed - which will
396
+ * still fire even if we now unregister the widget... so filter that out
397
+ */
398
  add_filter( 'show_recent_comments_widget_style', '__return_false' );
399
  }
400
 
402
  static $plugin;
403
  $plugin = plugin_basename( __FILE__ );
404
  if ( $file == $plugin ) {
405
+ $links[] = '<a href="https://github.com/WPDevelopers/disable-comments">GitHub</a>';
406
  }
407
  return $links;
408
  }
416
  if ( $file == $plugin && current_user_can( 'manage_options' ) ) {
417
  array_unshift(
418
  $links,
419
+ sprintf( '<a href="%s">%s</a>', esc_attr( $this->settings_page_url() ), __( 'Settings', 'disable-comments' ) ),
420
+ sprintf( '<a href="%s">%s</a>', esc_attr( $this->tools_page_url() ), __( 'Tools', 'disable-comments' ) )
421
  );
422
  }
423
 
457
  }
458
 
459
  public function single_site_deactivate() {
460
+ // for single sites, delete the options upon deactivation, not uninstall.
461
  delete_option( 'disable_comments_options' );
462
  }
463
  }
includes/comments-template.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
- /*
3
- Dummy comments template file.
4
  * This replaces the theme's comment template when comments are disabled everywhere
 
 
5
  */
1
  <?php
2
+ /**
3
+ * Dummy comments template file.
4
  * This replaces the theme's comment template when comments are disabled everywhere
5
+ *
6
+ * @package Disable_Comments
7
  */
includes/settings-page.php CHANGED
@@ -1,15 +1,21 @@
1
  <?php
 
 
 
 
 
 
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit;
4
  }
5
 
6
  $typeargs = array( 'public' => true );
7
  if ( $this->networkactive ) {
8
- $typeargs['_builtin'] = true; // stick to known types for network
9
  }
10
  $types = get_post_types( $typeargs, 'objects' );
11
  foreach ( array_keys( $types ) as $type ) {
12
- if ( ! in_array( $type, $this->modified_types ) && ! post_type_supports( $type, 'comments' ) ) { // the type doesn't support comments anyway
13
  unset( $types[ $type ] );
14
  }
15
  }
@@ -28,14 +34,14 @@ if ( isset( $_POST['submit'] ) ) {
28
 
29
  $this->options['disabled_post_types'] = $disabled_post_types;
30
 
31
- // Extra custom post types
32
  if ( $this->networkactive && ! empty( $_POST['extra_post_types'] ) ) {
33
  $extra_post_types = array_filter( array_map( 'sanitize_key', explode( ',', $_POST['extra_post_types'] ) ) );
34
- $this->options['extra_post_types'] = array_diff( $extra_post_types, array_keys( $types ) ); // Make sure we don't double up builtins
35
  }
36
 
37
  $this->update_options();
38
- $cache_message = WP_CACHE ? ' <strong>' . __( 'If a caching/performance plugin is active, please invalidate its cache to ensure that changes are reflected immediately.' ) . '</strong>' : '';
39
  echo '<div id="message" class="updated"><p>' . __( 'Options updated. Changes to the Admin Menu and Admin Bar will not appear until you leave or reload this page.', 'disable-comments' ) . $cache_message . '</p></div>';
40
  }
41
  ?>
1
  <?php
2
+ /**
3
+ * Setting page.
4
+ *
5
+ * @package Disable_Comments
6
+ */
7
+
8
  if ( ! defined( 'ABSPATH' ) ) {
9
  exit;
10
  }
11
 
12
  $typeargs = array( 'public' => true );
13
  if ( $this->networkactive ) {
14
+ $typeargs['_builtin'] = true; // stick to known types for network.
15
  }
16
  $types = get_post_types( $typeargs, 'objects' );
17
  foreach ( array_keys( $types ) as $type ) {
18
+ if ( ! in_array( $type, $this->modified_types ) && ! post_type_supports( $type, 'comments' ) ) { // the type doesn't support comments anyway.
19
  unset( $types[ $type ] );
20
  }
21
  }
34
 
35
  $this->options['disabled_post_types'] = $disabled_post_types;
36
 
37
+ // Extra custom post types.
38
  if ( $this->networkactive && ! empty( $_POST['extra_post_types'] ) ) {
39
  $extra_post_types = array_filter( array_map( 'sanitize_key', explode( ',', $_POST['extra_post_types'] ) ) );
40
+ $this->options['extra_post_types'] = array_diff( $extra_post_types, array_keys( $types ) ); // Make sure we don't double up builtins.
41
  }
42
 
43
  $this->update_options();
44
+ $cache_message = WP_CACHE ? ' <strong>' . __( 'If a caching/performance plugin is active, please invalidate its cache to ensure that changes are reflected immediately.', 'disable-comments' ) . '</strong>' : '';
45
  echo '<div id="message" class="updated"><p>' . __( 'Options updated. Changes to the Admin Menu and Admin Bar will not appear until you leave or reload this page.', 'disable-comments' ) . $cache_message . '</p></div>';
46
  }
47
  ?>
includes/tools-page.php CHANGED
@@ -1,4 +1,10 @@
1
  <?php
 
 
 
 
 
 
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit;
4
  }
@@ -19,11 +25,11 @@ if ( $comments_count <= 0 ) {
19
 
20
  $typeargs = array( 'public' => true );
21
  if ( $this->networkactive ) {
22
- $typeargs['_builtin'] = true; // stick to known types for network
23
  }
24
  $types = get_post_types( $typeargs, 'objects' );
25
  foreach ( array_keys( $types ) as $type ) {
26
- if ( ! in_array( $type, $this->modified_types ) && ! post_type_supports( $type, 'comments' ) ) { // the type doesn't support comments anyway
27
  unset( $types[ $type ] );
28
  }
29
  }
@@ -48,15 +54,15 @@ if ( isset( $_POST['delete'] ) && isset( $_POST['delete_mode'] ) ) {
48
  $delete_post_types = empty( $_POST['delete_types'] ) ? array() : (array) $_POST['delete_types'];
49
  $delete_post_types = array_intersect( $delete_post_types, array_keys( $types ) );
50
 
51
- // Extra custom post types
52
  if ( $this->networkactive && ! empty( $_POST['delete_extra_post_types'] ) ) {
53
  $delete_extra_post_types = array_filter( array_map( 'sanitize_key', explode( ',', $_POST['delete_extra_post_types'] ) ) );
54
- $delete_extra_post_types = array_diff( $delete_extra_post_types, array_keys( $types ) ); // Make sure we don't double up builtins
55
  $delete_post_types = array_merge( $delete_post_types, $delete_extra_post_types );
56
  }
57
 
58
  if ( ! empty( $delete_post_types ) ) {
59
- // Loop through post_types and remove comments/meta and set posts comment_count to 0
60
  foreach ( $delete_post_types as $delete_post_type ) {
61
  $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'" );
62
  $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'" );
1
  <?php
2
+ /**
3
+ * Tools page.
4
+ *
5
+ * @package Disable_Comments
6
+ */
7
+
8
  if ( ! defined( 'ABSPATH' ) ) {
9
  exit;
10
  }
25
 
26
  $typeargs = array( 'public' => true );
27
  if ( $this->networkactive ) {
28
+ $typeargs['_builtin'] = true; // stick to known types for network.
29
  }
30
  $types = get_post_types( $typeargs, 'objects' );
31
  foreach ( array_keys( $types ) as $type ) {
32
+ if ( ! in_array( $type, $this->modified_types ) && ! post_type_supports( $type, 'comments' ) ) { // the type doesn't support comments anyway.
33
  unset( $types[ $type ] );
34
  }
35
  }
54
  $delete_post_types = empty( $_POST['delete_types'] ) ? array() : (array) $_POST['delete_types'];
55
  $delete_post_types = array_intersect( $delete_post_types, array_keys( $types ) );
56
 
57
+ // Extra custom post types.
58
  if ( $this->networkactive && ! empty( $_POST['delete_extra_post_types'] ) ) {
59
  $delete_extra_post_types = array_filter( array_map( 'sanitize_key', explode( ',', $_POST['delete_extra_post_types'] ) ) );
60
+ $delete_extra_post_types = array_diff( $delete_extra_post_types, array_keys( $types ) ); // Make sure we don't double up builtins.
61
  $delete_post_types = array_merge( $delete_post_types, $delete_extra_post_types );
62
  }
63
 
64
  if ( ! empty( $delete_post_types ) ) {
65
+ // Loop through post_types and remove comments/meta and set posts comment_count to 0.
66
  foreach ( $delete_post_types as $delete_post_type ) {
67
  $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'" );
68
  $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'" );
languages/disable-comments.pot CHANGED
@@ -1,213 +1,190 @@
1
- # Copyright (C) 2017 Disable Comments
2
- # This file is distributed under the same license as the Disable Comments package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Disable Comments 1.6\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/disable-comments\n"
7
- "POT-Creation-Date: 2017-07-08 03:05:14+00:00\n"
8
  "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
-
15
- #: disable-comments.php:59
 
 
 
 
 
 
 
 
 
 
 
 
16
  msgid "Disable Comments requires WordPress version %s or greater."
17
  msgstr ""
18
 
19
- #: disable-comments.php:240 disable-comments.php:325
20
  msgid "Comments are closed."
21
  msgstr ""
22
 
23
- #: disable-comments.php:289
24
  msgid ""
25
- "Note: The <em>Disable Comments</em> plugin is currently active, and comments "
26
- "are completely disabled on: %s. Many of the settings below will not be "
27
- "applicable for those post types."
28
  msgstr ""
29
 
30
- #: disable-comments.php:289
31
  msgid ", "
32
  msgstr ""
33
 
34
- #: disable-comments.php:317
35
  msgid ""
36
  "The <em>Disable Comments</em> plugin is active, but isn't configured to do "
37
  "anything yet. Visit the <a href=\"%s\">configuration page</a> to choose "
38
  "which post types to disable comments on."
39
  msgstr ""
40
 
41
- #: disable-comments.php:382
42
  msgid "Settings"
43
  msgstr ""
44
 
45
- #: disable-comments.php:383
46
  msgid "Tools"
47
  msgstr ""
48
 
49
- #: disable-comments.php:391
50
- msgctxt "settings menu title"
51
- msgid "Disable Comments"
52
- msgstr ""
53
-
54
- #: disable-comments.php:403 includes/tools-page.php:7
55
- #: includes/tools-page.php:103
56
  msgid "Delete Comments"
57
  msgstr ""
58
 
59
- #: includes/settings-page.php:43
60
  msgid ""
61
  "If a caching/performance plugin is active, please invalidate its cache to "
62
  "ensure that changes are reflected immediately."
63
  msgstr ""
64
 
65
- #: includes/settings-page.php:44
66
  msgid ""
67
  "Options updated. Changes to the Admin Menu and Admin Bar will not appear "
68
  "until you leave or reload this page."
69
  msgstr ""
70
 
71
- #. #-#-#-#-# disable-comments.pot (Disable Comments 1.6) #-#-#-#-#
72
- #. Plugin Name of the plugin/theme
73
- #: includes/settings-page.php:49
74
- msgid "Disable Comments"
75
- msgstr ""
76
-
77
- #: includes/settings-page.php:52
78
  msgid ""
79
  "<em>Disable Comments</em> is Network Activated. The settings below will "
80
  "affect <strong>all sites</strong> in this network."
81
  msgstr ""
82
 
83
- #: includes/settings-page.php:54
84
  msgid ""
85
  "It seems that a caching/performance plugin is active on this site. Please "
86
  "manually invalidate that plugin's cache after making any changes to the "
87
  "settings below."
88
  msgstr ""
89
 
90
- #: includes/settings-page.php:58 includes/tools-page.php:85
91
  msgid "Everywhere"
92
  msgstr ""
93
 
94
- #: includes/settings-page.php:58
95
  msgid "Disable all comment-related controls and settings in WordPress."
96
  msgstr ""
97
 
98
- #: includes/settings-page.php:59
99
  msgid ""
100
- "%s: This option is global and will affect your entire site. Use it only if "
101
- "you want to disable comments <em>everywhere</em>. A complete description of "
102
- "what this option does is <a href=\"%s\" target=\"_blank\">available here</a>."
 
103
  msgstr ""
104
 
105
- #: includes/settings-page.php:59 includes/settings-page.php:80
106
- #: includes/settings-page.php:82 includes/settings-page.php:110
107
- #: includes/tools-page.php:86 includes/tools-page.php:97
108
  msgid "Warning"
109
  msgstr ""
110
 
111
- #: includes/settings-page.php:61
112
  msgid "On certain post types"
113
  msgstr ""
114
 
115
- #: includes/settings-page.php:67 includes/tools-page.php:94
116
  msgid ""
117
  "Only the built-in post types appear above. If you want to disable comments "
118
- "on other custom post types on the entire network, you can supply a comma-"
119
- "separated list of post types below (use the slug that identifies the post "
120
- "type)."
121
  msgstr ""
122
 
123
- #: includes/settings-page.php:68 includes/tools-page.php:95
124
  msgid "Custom post types:"
125
  msgstr ""
126
 
127
- #: includes/settings-page.php:70
128
- msgid ""
129
- "Disabling comments will also disable trackbacks and pingbacks. All comment-"
130
- "related fields will also be hidden from the edit/quick-edit screens of the "
131
- "affected posts. These settings cannot be overridden for individual posts."
132
- msgstr ""
133
-
134
- #: includes/settings-page.php:75
135
- msgid "Other options"
136
- msgstr ""
137
-
138
- #: includes/settings-page.php:79
139
- msgid "Use persistent mode"
140
- msgstr ""
141
-
142
- #: includes/settings-page.php:80
143
- msgid ""
144
- "%s: <strong>This will make persistent changes to your database &mdash; "
145
- "comments will remain closed even if you later disable the plugin!</strong> "
146
- "You should not use it if you only want to disable comments temporarily. "
147
- "Please <a href=\"%s\" target=\"_blank\">read the FAQ</a> before selecting "
148
- "this option."
149
- msgstr ""
150
-
151
- #: includes/settings-page.php:82
152
  msgid ""
153
- "%s: Entering persistent mode on large multi-site networks requires a large "
154
- "number of database queries and can take a while. Use with caution!"
 
 
155
  msgstr ""
156
 
157
- #: includes/settings-page.php:89
158
  msgid "Save Changes"
159
  msgstr ""
160
 
161
- #: includes/settings-page.php:110
162
- msgid ""
163
- "%s: Selecting this option will make persistent changes to your database. Are "
164
- "you sure you want to enable it?"
165
- msgstr ""
166
-
167
- #: includes/tools-page.php:13 includes/tools-page.php:75
168
  msgid "No comments available for deletion."
169
  msgstr ""
170
 
171
- #: includes/tools-page.php:38
172
  msgid "All comments have been deleted."
173
  msgstr ""
174
 
175
- #: includes/tools-page.php:40 includes/tools-page.php:43
176
  msgid "Internal error occured. Please try again later."
177
  msgstr ""
178
 
179
- #: includes/tools-page.php:62
180
- msgid "All comments have been deleted for %ss."
181
  msgstr ""
182
 
183
- #: includes/tools-page.php:68
184
  msgid "Comment Deletion Complete"
185
  msgstr ""
186
 
187
- #: includes/tools-page.php:85
188
  msgid "Delete all comments in WordPress."
189
  msgstr ""
190
 
191
- #: includes/tools-page.php:86
192
  msgid ""
193
  "%s: This function and will affect your entire site. Use it only if you want "
194
  "to delete comments <em>everywhere</em>."
195
  msgstr ""
196
 
197
- #: includes/tools-page.php:88
198
  msgid "For certain post types"
199
  msgstr ""
200
 
201
- #: includes/tools-page.php:97
202
  msgid ""
203
  "%s: Deleting comments will remove existing comment entries in the database "
204
  "and cannot be reverted without a database backup."
205
  msgstr ""
206
 
207
- #: includes/tools-page.php:102
208
  msgid "Total Comments:"
209
  msgstr ""
210
 
 
 
 
 
211
  #. Plugin URI of the plugin/theme
212
  msgid "https://wordpress.org/plugins/disable-comments/"
213
  msgstr ""
@@ -225,3 +202,13 @@ msgstr ""
225
  #. Author URI of the plugin/theme
226
  msgid "http://www.rayofsolaris.net/"
227
  msgstr ""
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020 Samir Shah
2
+ # This file is distributed under the GPL2.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Disable Comments 1.10.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/disable-comments\n"
7
+ "POT-Creation-Date: 2020-05-01 06:45:42+00:00\n"
8
  "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "Language: en\n"
15
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+ "X-Poedit-Country: United States\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
+ "X-Poedit-KeywordsList: "
19
+ "__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
20
+ "attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
21
+ "X-Poedit-Basepath: ../\n"
22
+ "X-Poedit-SearchPath-0: .\n"
23
+ "X-Poedit-Bookmarks: \n"
24
+ "X-Textdomain-Support: yes\n"
25
+ "X-Generator: grunt-wp-i18n 1.0.3\n"
26
+
27
+ #: disable-comments.php:61
28
  msgid "Disable Comments requires WordPress version %s or greater."
29
  msgstr ""
30
 
31
+ #: disable-comments.php:247 disable-comments.php:346 disable-comments.php:353
32
  msgid "Comments are closed."
33
  msgstr ""
34
 
35
+ #: disable-comments.php:312
36
  msgid ""
37
+ "Note: The <em>Disable Comments</em> plugin is currently active, and "
38
+ "comments are completely disabled on: %s. Many of the settings below will "
39
+ "not be applicable for those post types."
40
  msgstr ""
41
 
42
+ #: disable-comments.php:312
43
  msgid ", "
44
  msgstr ""
45
 
46
+ #: disable-comments.php:338
47
  msgid ""
48
  "The <em>Disable Comments</em> plugin is active, but isn't configured to do "
49
  "anything yet. Visit the <a href=\"%s\">configuration page</a> to choose "
50
  "which post types to disable comments on."
51
  msgstr ""
52
 
53
+ #: disable-comments.php:418
54
  msgid "Settings"
55
  msgstr ""
56
 
57
+ #: disable-comments.php:419
58
  msgid "Tools"
59
  msgstr ""
60
 
61
+ #: disable-comments.php:440 includes/tools-page.php:13
62
+ #: includes/tools-page.php:116
 
 
 
 
 
63
  msgid "Delete Comments"
64
  msgstr ""
65
 
66
+ #: includes/settings-page.php:44
67
  msgid ""
68
  "If a caching/performance plugin is active, please invalidate its cache to "
69
  "ensure that changes are reflected immediately."
70
  msgstr ""
71
 
72
+ #: includes/settings-page.php:45
73
  msgid ""
74
  "Options updated. Changes to the Admin Menu and Admin Bar will not appear "
75
  "until you leave or reload this page."
76
  msgstr ""
77
 
78
+ #: includes/settings-page.php:53
 
 
 
 
 
 
79
  msgid ""
80
  "<em>Disable Comments</em> is Network Activated. The settings below will "
81
  "affect <strong>all sites</strong> in this network."
82
  msgstr ""
83
 
84
+ #: includes/settings-page.php:56
85
  msgid ""
86
  "It seems that a caching/performance plugin is active on this site. Please "
87
  "manually invalidate that plugin's cache after making any changes to the "
88
  "settings below."
89
  msgstr ""
90
 
91
+ #: includes/settings-page.php:61 includes/tools-page.php:95
92
  msgid "Everywhere"
93
  msgstr ""
94
 
95
+ #: includes/settings-page.php:61
96
  msgid "Disable all comment-related controls and settings in WordPress."
97
  msgstr ""
98
 
99
+ #: includes/settings-page.php:62
100
  msgid ""
101
+ "%1$s: This option is global and will affect your entire site. Use it only "
102
+ "if you want to disable comments <em>everywhere</em>. A complete description "
103
+ "of what this option does is <a href=\"%2$s\" target=\"_blank\">available "
104
+ "here</a>."
105
  msgstr ""
106
 
107
+ #: includes/settings-page.php:62 includes/tools-page.php:96
108
+ #: includes/tools-page.php:110
 
109
  msgid "Warning"
110
  msgstr ""
111
 
112
+ #: includes/settings-page.php:64
113
  msgid "On certain post types"
114
  msgstr ""
115
 
116
+ #: includes/settings-page.php:73 includes/tools-page.php:107
117
  msgid ""
118
  "Only the built-in post types appear above. If you want to disable comments "
119
+ "on other custom post types on the entire network, you can supply a "
120
+ "comma-separated list of post types below (use the slug that identifies the "
121
+ "post type)."
122
  msgstr ""
123
 
124
+ #: includes/settings-page.php:74 includes/tools-page.php:108
125
  msgid "Custom post types:"
126
  msgstr ""
127
 
128
+ #: includes/settings-page.php:76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  msgid ""
130
+ "Disabling comments will also disable trackbacks and pingbacks. All "
131
+ "comment-related fields will also be hidden from the edit/quick-edit screens "
132
+ "of the affected posts. These settings cannot be overridden for individual "
133
+ "posts."
134
  msgstr ""
135
 
136
+ #: includes/settings-page.php:81
137
  msgid "Save Changes"
138
  msgstr ""
139
 
140
+ #: includes/tools-page.php:20 includes/tools-page.php:86
 
 
 
 
 
 
141
  msgid "No comments available for deletion."
142
  msgstr ""
143
 
144
+ #: includes/tools-page.php:46
145
  msgid "All comments have been deleted."
146
  msgstr ""
147
 
148
+ #: includes/tools-page.php:48 includes/tools-page.php:51
149
  msgid "Internal error occured. Please try again later."
150
  msgstr ""
151
 
152
+ #: includes/tools-page.php:73
153
+ msgid "All comments have been deleted for %s."
154
  msgstr ""
155
 
156
+ #: includes/tools-page.php:79
157
  msgid "Comment Deletion Complete"
158
  msgstr ""
159
 
160
+ #: includes/tools-page.php:95
161
  msgid "Delete all comments in WordPress."
162
  msgstr ""
163
 
164
+ #: includes/tools-page.php:96
165
  msgid ""
166
  "%s: This function and will affect your entire site. Use it only if you want "
167
  "to delete comments <em>everywhere</em>."
168
  msgstr ""
169
 
170
+ #: includes/tools-page.php:98
171
  msgid "For certain post types"
172
  msgstr ""
173
 
174
+ #: includes/tools-page.php:110
175
  msgid ""
176
  "%s: Deleting comments will remove existing comment entries in the database "
177
  "and cannot be reverted without a database backup."
178
  msgstr ""
179
 
180
+ #: includes/tools-page.php:115
181
  msgid "Total Comments:"
182
  msgstr ""
183
 
184
+ #. Plugin Name of the plugin/theme
185
+ msgid "Disable Comments"
186
+ msgstr ""
187
+
188
  #. Plugin URI of the plugin/theme
189
  msgid "https://wordpress.org/plugins/disable-comments/"
190
  msgstr ""
202
  #. Author URI of the plugin/theme
203
  msgid "http://www.rayofsolaris.net/"
204
  msgstr ""
205
+
206
+ #: disable-comments.php:427
207
+ msgctxt "settings menu title"
208
+ msgid "Disable Comments"
209
+ msgstr ""
210
+
211
+ #: includes/settings-page.php:50
212
+ msgctxt "settings page title"
213
+ msgid "Disable Comments"
214
+ msgstr ""
readme.txt CHANGED
@@ -1,10 +1,13 @@
1
  === Disable Comments ===
2
- Contributors: solarissmoke, garrett-eclipse
3
- Donate link: http://www.rayofsolaris.net/donate/
4
- Tags: comments, disable, global
5
  Requires at least: 5.0
6
- Tested up to: 5.3
7
- Stable tag: trunk
 
 
 
8
 
9
  Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. Multisite friendly. Provides tool to delete all comments or according to post type.
10
 
@@ -18,9 +21,85 @@ Additionally, comment-related items can be removed from the Dashboard, Widgets,
18
 
19
  If you come across any bugs or have suggestions, please use the plugin support forum. I can't fix it if I don't know it's broken! Please check the [FAQ](https://wordpress.org/plugins/disable-comments/faq/) for common issues.
20
 
21
- Want to contribute? Here's the [GitHub development repository](https://github.com/solarissmoke/disable-comments).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- A [must-use version](https://github.com/solarissmoke/disable-comments-mu) of the plugin is also available.
24
 
25
  == Frequently Asked Questions ==
26
 
@@ -48,31 +127,23 @@ You can also bulk-edit the comment status of multiple posts from the [posts scre
48
 
49
  Go to the tools page for the Disable Comments plugin and utlize the Delete Comments tool to delete all comments or according to the specified post types from your database.
50
 
51
- == Details ==
52
 
53
- The plugin provides the option to **completely disable the commenting feature in WordPress**. When this option is selected, the following changes are made:
54
 
55
- * All "Comments" links are hidden from the Admin Menu and Admin Bar;
56
- * All comment-related sections ("Recent Comments", "Discussion" etc.) are hidden from the WordPress Dashboard;
57
- * All comment-related widgets are disabled (so your theme cannot use them);
58
- * The "Discussion" settings page is hidden;
59
- * All comment RSS/Atom feeds are disabled (and requests for these will be redirected to the parent post);
60
- * The X-Pingback HTTP header is removed from all pages;
61
- * Outgoing pingbacks are disabled.
62
 
63
- **Please delete any existing comments on your site before applying this setting, otherwise (depending on your theme) those comments may still be displayed to visitors. You can use the Delete Comments tool to delete any existing comments on your site.**
64
-
65
- == Advanced Configuration ==
66
 
67
- Some of the plugin's behaviour can be modified by site administrators and plugin/theme developers through code:
68
 
69
- * Define `DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE` and set it to `false` to prevent the plugin from replacing the theme's comment template with an empty one.
70
 
71
- * Define `DISABLE_COMMENTS_ALLOW_DISCUSSION_SETTINGS` and set it to `true` to prevent the plugin from hiding the Discussion settings page.
72
 
73
- These definitions can be made either in your main `wp-config.php` or in your theme's `functions.php` file.
 
 
74
 
75
- == Changelog ==
 
76
 
77
  = 1.10.0 =
78
  * Disable "recent comments" Gutenberg block.
@@ -205,8 +276,7 @@ These definitions can be made either in your main `wp-config.php` or in your the
205
  = 0.2 =
206
  * Bugfix: Make sure pingbacks are also prevented when comments are disabled.
207
 
208
- == Installation ==
209
 
210
- 1. Upload the plugin folder to the `/wp-content/plugins/` directory
211
- 2. Activate the plugin through the 'Plugins' menu in WordPress
212
- 3. The plugin settings can be accessed via the 'Settings' menu in the administration area (either your site administration for single-site installs, or your network administration for network installs).
1
  === Disable Comments ===
2
+ Contributors: Asif2BD, priyomukul, wpdevteam, re_enter_rupok, solarissmoke, garrett-eclipse
3
+ Donate link: https://wpdeveloper.net/
4
+ Tags: comments, disable, global, disable comments, delete comments, stop spam, bulk comment delete, comment management
5
  Requires at least: 5.0
6
+ Tested up to: 5.5
7
+ Requires PHP: 5.4
8
+ Stable tag: 1.10.3
9
+ License: GPL-3.0-or-later
10
+ License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
12
  Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. Multisite friendly. Provides tool to delete all comments or according to post type.
13
 
21
 
22
  If you come across any bugs or have suggestions, please use the plugin support forum. I can't fix it if I don't know it's broken! Please check the [FAQ](https://wordpress.org/plugins/disable-comments/faq/) for common issues.
23
 
24
+ Want to contribute? Here's the [GitHub development repository](https://github.com/WPDevelopers/disable-comments).
25
+
26
+ A [must-use version](https://github.com/WPDevelopers/disable-comments-mu) of the plugin is also available.
27
+
28
+
29
+ ### Details
30
+
31
+ The plugin provides the option to **completely disable the commenting feature in WordPress**. When this option is selected, the following changes are made:
32
+
33
+ * All "Comments" links are hidden from the Admin Menu and Admin Bar;
34
+ * All comment-related sections ("Recent Comments", "Discussion" etc.) are hidden from the WordPress Dashboard;
35
+ * All comment-related widgets are disabled (so your theme cannot use them);
36
+ * The "Discussion" settings page is hidden;
37
+ * All comment RSS/Atom feeds are disabled (and requests for these will be redirected to the parent post);
38
+ * The X-Pingback HTTP header is removed from all pages;
39
+ * Outgoing pingbacks are disabled.
40
+
41
+ **Please delete any existing comments on your site before applying this setting, otherwise (depending on your theme) those comments may still be displayed to visitors. You can use the Delete Comments tool to delete any existing comments on your site.**
42
+
43
+ ### Advanced Configuration
44
+
45
+ Some of the plugin's behaviour can be modified by site administrators and plugin/theme developers through code:
46
+
47
+ * Define `DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE` and set it to `false` to prevent the plugin from replacing the theme's comment template with an empty one.
48
+
49
+ * Define `DISABLE_COMMENTS_ALLOW_DISCUSSION_SETTINGS` and set it to `true` to prevent the plugin from hiding the Discussion settings page.
50
+
51
+ These definitions can be made either in your main `wp-config.php` or in your theme's `functions.php` file.
52
+
53
+
54
+ ### This plugin is maintained by the [WPDeveloper](https://wpdeveloper.net/).
55
+
56
+
57
+ ### 💙 LOVED Disable Comments?
58
+
59
+ - Join our [Facebook Group](https://www.facebook.com/groups/wpdeveloper.net/)
60
+
61
+ - If you love Disable Comments, [rate us on WordPress](https://wordpress.org/support/plugin/disable-comments/reviews/?filter=5)
62
+
63
+
64
+ 🔥 GET FREEBIES FOR YOUR WORDPRESS SITE
65
+
66
+ Consider checking out our other WordPress solutions & boost your WordPress website:
67
+
68
+ 🔝 [Essential Addons For Elementor](https://wordpress.org/plugins/essential-addons-for-elementor-lite/): Most popular Elementor addons with 70+ widgets & ready blocks
69
+
70
+ 🔔[NotificationX](https://notificationx.com/) – Best Social Proof & FOMO Marketing Solution to increase conversion rates.
71
+
72
+ 📄 [EmbedPress](https://wordpress.org/plugins/embedpress/): EmbedPress lets you embed videos, images, posts, audio, maps and upload PDF, DOC, PPT & all other types of content into your WordPress site with one-click and showcase it beautifully for the visitors.
73
+
74
+ ☁ [Templately](https://wordpress.org/plugins/templately/): Free templates library for Elementor & Gutenberg along with the cloud collaboration for WordPress.
75
+
76
+ 📚 [BetterDocs](https://wordpress.org/plugins/betterdocs/): Best Documentation & Knowledge Base Plugin for WordPress reduce manual support tickets & improve user experience.
77
+
78
+ ⏰ [WP Scheduled Posts](https://wordpress.org/plugins/wp-scheduled-posts/): Advanced editorial calendar & complete solution for WordPress Post Scheduling, social sharing, missed scheduled alerts and more.
79
+
80
+ ⭐ [ReviewX](https://wordpress.org/plugins/reviewx/): WooCommerce Product review plugin that allows users to submit product reviews with multiple criteria, photos, video and more.
81
+
82
+ ⚡ [Flexia](http://wordpress.org/plugins/flexia): Most lightweight, customizable & multi purpose theme for WordPress.
83
+
84
+
85
+ Visit [WPDeveloper](https://wpdeveloper.net/) to learn more about how to do better in WordPress with [Help Tutorial, Tips & Tricks](https://wpdeveloper.net/blog).
86
+
87
+
88
+
89
+ == Installation ==
90
+
91
+ = Modern Way: =
92
+ 1. Go to the WordPress Dashboard "Add New Plugin" section.
93
+ 2. Search For "Disable Comments".
94
+ 3. Install, then Activate it.
95
+ 4. The plugin settings can be accessed via the 'Settings' menu in the administration area (either your site administration for single-site installs, or your network administration for network installs).
96
+
97
+ = Old Way: =
98
+ 1. Upload the plugin folder to the `/wp-content/plugins/` directory
99
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
100
+ 3. The plugin settings can be accessed via the 'Settings' menu in the administration area (either your site administration for single-site installs, or your network administration for network installs).
101
+
102
 
 
103
 
104
  == Frequently Asked Questions ==
105
 
127
 
128
  Go to the tools page for the Disable Comments plugin and utlize the Delete Comments tool to delete all comments or according to the specified post types from your database.
129
 
 
130
 
 
131
 
132
+ == Screenshots ==
 
 
 
 
 
 
133
 
134
+ 1. Setting Screen for Disable Comments
135
+ 2. Delete Comments under Tools menu.
 
136
 
 
137
 
 
138
 
139
+ == Changelog ==
140
 
141
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
142
+ and this project adheres to [Semantic Versioning](http://semver.org/).
143
+ This will be maiintained from August 19, 2020 - @asif2bd
144
 
145
+ = [1.10.3] - 2020-07-29 =
146
+ * Minor fix - changelog backported.
147
 
148
  = 1.10.0 =
149
  * Disable "recent comments" Gutenberg block.
276
  = 0.2 =
277
  * Bugfix: Make sure pingbacks are also prevented when comments are disabled.
278
 
 
279
 
280
+ == Upgrade Notice ==
281
+
282
+ Minor Update: Bug Fix
src/disable-comments.js CHANGED
@@ -1,9 +1,5 @@
1
  wp.domReady(() => {
2
  if(wp.blocks) {
3
- wp.blocks.getBlockTypes().forEach((block) => {
4
- if (disable_comments.disabled_blocks.includes(block.name)) {
5
- wp.blocks.unregisterBlockType(block.name);
6
- }
7
- });
8
  }
9
  });
1
  wp.domReady(() => {
2
  if(wp.blocks) {
3
+ wp.blocks.unregisterBlockType('core/latest-comments');
 
 
 
 
4
  }
5
  });
uninstall.php CHANGED
@@ -1,4 +1,10 @@
1
  <?php
 
 
 
 
 
 
2
  if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
3
  exit;
4
  }
1
  <?php
2
+ /**
3
+ * Uninstall script
4
+ *
5
+ * @package Disable_Comments
6
+ */
7
+
8
  if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
9
  exit;
10
  }