Disable Comments - Version 1.7

Version Description

  • Dropped logic to try and hide the comments link from the Meta widget. Administrators should manually add styling to hide this link, or replace the Meta widget with an alternative.
  • Removed the disable_comments_allow_persistent_mode filter. Define DISABLE_COMMENTS_ALLOW_PERSISTENT_MODE instead.
Download this release

Release Info

Developer solarissmoke
Plugin Icon 128x128 Disable Comments
Version 1.7
Comparing to
See all releases

Code changes from version 1.6 to 1.7

disable-comments.php CHANGED
@@ -3,7 +3,7 @@
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.6
7
  Author: Samir Shah
8
  Author URI: http://www.rayofsolaris.net/
9
  License: GPL2
@@ -28,7 +28,7 @@ class Disable_Comments {
28
  return self::$instance;
29
  }
30
 
31
- private function __construct() {
32
  // are we network activated?
33
  $this->networkactive = ( is_multisite() && array_key_exists( plugin_basename( __FILE__ ), (array) get_site_option( 'active_sitewide_plugins' ) ) );
34
 
@@ -196,7 +196,6 @@ class Disable_Comments {
196
 
197
  if( $this->options['remove_everywhere'] ) {
198
  add_filter( 'feed_links_show_comments_feed', '__return_false' );
199
- add_action( 'wp_footer', array( $this, 'hide_meta_widget_link' ), 100 );
200
  }
201
  }
202
  }
@@ -341,12 +340,6 @@ jQuery(document).ready(function($){
341
  </script>';
342
  }
343
 
344
- public function hide_meta_widget_link(){
345
- if ( is_active_widget( false, false, 'meta', true ) && wp_script_is( 'jquery', 'enqueued' ) ) {
346
- echo '<script> jQuery(function($){ $(".widget_meta a[href=\'' . esc_url( get_bloginfo( 'comments_rss2_url' ) ) . '\']").parent().remove(); }); </script>';
347
- }
348
- }
349
-
350
  public function filter_existing_comments($comments, $post_id) {
351
  $post = get_post( $post_id );
352
  return ( $this->options['remove_everywhere'] || $this->is_post_type_disabled( $post->post_type ) ) ? array() : $comments;
@@ -388,7 +381,7 @@ jQuery(document).ready(function($){
388
  }
389
 
390
  public function settings_menu() {
391
- $title = __( 'Disable Comments', 'disable-comments' );
392
  if( $this->networkactive )
393
  add_submenu_page( 'settings.php', $title, $title, 'manage_network_plugins', 'disable_comments_settings', array( $this, 'settings_page' ) );
394
  else
@@ -443,8 +436,6 @@ jQuery(document).ready(function($){
443
  if( defined( 'DISABLE_COMMENTS_ALLOW_PERSISTENT_MODE' ) && DISABLE_COMMENTS_ALLOW_PERSISTENT_MODE == false ) {
444
  return false;
445
  }
446
- // The filter below is deprecated and will be removed in future versions. Use the define instead.
447
- return apply_filters( 'disable_comments_allow_persistent_mode', true );
448
  }
449
 
450
  public function single_site_deactivate() {
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.7
7
  Author: Samir Shah
8
  Author URI: http://www.rayofsolaris.net/
9
  License: GPL2
28
  return self::$instance;
29
  }
30
 
31
+ function __construct() {
32
  // are we network activated?
33
  $this->networkactive = ( is_multisite() && array_key_exists( plugin_basename( __FILE__ ), (array) get_site_option( 'active_sitewide_plugins' ) ) );
34
 
196
 
197
  if( $this->options['remove_everywhere'] ) {
198
  add_filter( 'feed_links_show_comments_feed', '__return_false' );
 
199
  }
200
  }
201
  }
340
  </script>';
341
  }
342
 
 
 
 
 
 
 
343
  public function filter_existing_comments($comments, $post_id) {
344
  $post = get_post( $post_id );
345
  return ( $this->options['remove_everywhere'] || $this->is_post_type_disabled( $post->post_type ) ) ? array() : $comments;
381
  }
382
 
383
  public function settings_menu() {
384
+ $title = _x( 'Disable Comments', 'settings menu title', 'disable-comments' );
385
  if( $this->networkactive )
386
  add_submenu_page( 'settings.php', $title, $title, 'manage_network_plugins', 'disable_comments_settings', array( $this, 'settings_page' ) );
387
  else
436
  if( defined( 'DISABLE_COMMENTS_ALLOW_PERSISTENT_MODE' ) && DISABLE_COMMENTS_ALLOW_PERSISTENT_MODE == false ) {
437
  return false;
438
  }
 
 
439
  }
440
 
441
  public function single_site_deactivate() {
includes/settings-page.php CHANGED
@@ -46,7 +46,7 @@ if ( isset( $_POST['submit'] ) ) {
46
  ?>
47
  <style> .indent {padding-left: 2em} </style>
48
  <div class="wrap">
49
- <h1><?php _e( 'Disable Comments', 'disable-comments') ?></h1>
50
  <?php
51
  if( $this->networkactive )
52
  echo '<div class="updated"><p>' . __( '<em>Disable Comments</em> is Network Activated. The settings below will affect <strong>all sites</strong> in this network.', 'disable-comments') . '</p></div>';
46
  ?>
47
  <style> .indent {padding-left: 2em} </style>
48
  <div class="wrap">
49
+ <h1><?php _e( 'Disable Comments', 'settings page title', 'disable-comments') ?></h1>
50
  <?php
51
  if( $this->networkactive )
52
  echo '<div class="updated"><p>' . __( '<em>Disable Comments</em> is Network Activated. The settings below will affect <strong>all sites</strong> in this network.', 'disable-comments') . '</p></div>';
languages/disable-comments.pot CHANGED
@@ -1,14 +1,14 @@
1
- # Copyright (C) 2016 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: 2016-12-02 07:47:59+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: 2016-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
@@ -21,7 +21,10 @@ msgid "Comments are closed."
21
  msgstr ""
22
 
23
  #: disable-comments.php:289
24
- msgid "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."
 
 
 
25
  msgstr ""
26
 
27
  #: disable-comments.php:289
@@ -29,7 +32,10 @@ msgid ", "
29
  msgstr ""
30
 
31
  #: disable-comments.php:317
32
- msgid "The <em>Disable Comments</em> plugin is active, but isn't configured to do anything yet. Visit the <a href=\"%s\">configuration page</a> to choose which post types to disable comments on."
 
 
 
33
  msgstr ""
34
 
35
  #: disable-comments.php:382
@@ -40,7 +46,8 @@ msgstr ""
40
  msgid "Tools"
41
  msgstr ""
42
 
43
- #: disable-comments.php:391 includes/settings-page.php:49
 
44
  msgid "Disable Comments"
45
  msgstr ""
46
 
@@ -50,19 +57,34 @@ msgid "Delete Comments"
50
  msgstr ""
51
 
52
  #: includes/settings-page.php:43
53
- msgid "If a caching/performance plugin is active, please invalidate its cache to ensure that changes are reflected immediately."
 
 
54
  msgstr ""
55
 
56
  #: includes/settings-page.php:44
57
- msgid "Options updated. Changes to the Admin Menu and Admin Bar will not appear until you leave or reload this page."
 
 
 
 
 
 
 
 
58
  msgstr ""
59
 
60
  #: includes/settings-page.php:52
61
- msgid "<em>Disable Comments</em> is Network Activated. The settings below will affect <strong>all sites</strong> in this network."
 
 
62
  msgstr ""
63
 
64
  #: includes/settings-page.php:54
65
- msgid "It seems that a caching/performance plugin is active on this site. Please manually invalidate that plugin's cache after making any changes to the settings below."
 
 
 
66
  msgstr ""
67
 
68
  #: includes/settings-page.php:58 includes/tools-page.php:85
@@ -74,7 +96,10 @@ msgid "Disable all comment-related controls and settings in WordPress."
74
  msgstr ""
75
 
76
  #: includes/settings-page.php:59
77
- msgid "%s: This option is global and will affect your entire site. Use it only if you want to disable comments <em>everywhere</em>. A complete description of what this option does is <a href=\"%s\" target=\"_blank\">available here</a>."
 
 
 
78
  msgstr ""
79
 
80
  #: includes/settings-page.php:59 includes/settings-page.php:80
@@ -88,7 +113,11 @@ msgid "On certain post types"
88
  msgstr ""
89
 
90
  #: includes/settings-page.php:67 includes/tools-page.php:94
91
- msgid "Only the built-in post types appear above. If you want to disable comments on other custom post types on the entire network, you can supply a comma-separated list of post types below (use the slug that identifies the post type)."
 
 
 
 
92
  msgstr ""
93
 
94
  #: includes/settings-page.php:68 includes/tools-page.php:95
@@ -96,7 +125,10 @@ msgid "Custom post types:"
96
  msgstr ""
97
 
98
  #: includes/settings-page.php:70
99
- msgid "Disabling comments will also disable trackbacks and pingbacks. All comment-related fields will also be hidden from the edit/quick-edit screens of the affected posts. These settings cannot be overridden for individual posts."
 
 
 
100
  msgstr ""
101
 
102
  #: includes/settings-page.php:75
@@ -108,11 +140,18 @@ msgid "Use persistent mode"
108
  msgstr ""
109
 
110
  #: includes/settings-page.php:80
111
- msgid "%s: <strong>This will make persistent changes to your database &mdash; comments will remain closed even if you later disable the plugin!</strong> You should not use it if you only want to disable comments temporarily. Please <a href=\"%s\" target=\"_blank\">read the FAQ</a> before selecting this option."
 
 
 
 
 
112
  msgstr ""
113
 
114
  #: includes/settings-page.php:82
115
- msgid "%s: Entering persistent mode on large multi-site networks requires a large number of database queries and can take a while. Use with caution!"
 
 
116
  msgstr ""
117
 
118
  #: includes/settings-page.php:89
@@ -120,7 +159,9 @@ msgid "Save Changes"
120
  msgstr ""
121
 
122
  #: includes/settings-page.php:110
123
- msgid "%s: Selecting this option will make persistent changes to your database. Are you sure you want to enable it?"
 
 
124
  msgstr ""
125
 
126
  #: includes/tools-page.php:13 includes/tools-page.php:75
@@ -148,7 +189,9 @@ msgid "Delete all comments in WordPress."
148
  msgstr ""
149
 
150
  #: includes/tools-page.php:86
151
- msgid "%s: This function and will affect your entire site. Use it only if you want to delete comments <em>everywhere</em>."
 
 
152
  msgstr ""
153
 
154
  #: includes/tools-page.php:88
@@ -156,16 +199,29 @@ msgid "For certain post types"
156
  msgstr ""
157
 
158
  #: includes/tools-page.php:97
159
- msgid "%s: Deleting comments will remove existing comment entries in the database and cannot be reverted without a database backup."
 
 
160
  msgstr ""
161
 
162
  #: includes/tools-page.php:102
163
  msgid "Total Comments:"
164
  msgstr ""
165
- #. Plugin Name of the plugin/theme
166
- msgid "Disable Comments"
 
167
  msgstr ""
168
 
169
  #. Description of the plugin/theme
170
- msgid "Allows administrators to globally disable comments on their site. Comments can be disabled according to post type."
 
 
 
 
 
 
 
 
 
 
171
  msgstr ""
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
 
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
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
46
  msgid "Tools"
47
  msgstr ""
48
 
49
+ #: disable-comments.php:391
50
+ msgctxt "settings menu title"
51
  msgid "Disable Comments"
52
  msgstr ""
53
 
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
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
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
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
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
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
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
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 ""
214
 
215
  #. Description of the plugin/theme
216
+ msgid ""
217
+ "Allows administrators to globally disable comments on their site. Comments "
218
+ "can be disabled according to post type."
219
+ msgstr ""
220
+
221
+ #. Author of the plugin/theme
222
+ msgid "Samir Shah"
223
+ msgstr ""
224
+
225
+ #. Author URI of the plugin/theme
226
+ msgid "http://www.rayofsolaris.net/"
227
  msgstr ""
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: solarissmoke
3
  Donate link: http://www.rayofsolaris.net/donate/
4
  Tags: comments, disable, global
5
- Requires at least: 4.0
6
- Tested up to: 4.7
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.
@@ -72,6 +72,10 @@ These definitions can be made either in your main `wp-config.php` or in your the
72
 
73
  == Changelog ==
74
 
 
 
 
 
75
  = 1.6 =
76
  * Added a tool for deleting comments in bulk.
77
 
2
  Contributors: solarissmoke
3
  Donate link: http://www.rayofsolaris.net/donate/
4
  Tags: comments, disable, global
5
+ Requires at least: 4.1
6
+ Tested up to: 4.8
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.
72
 
73
  == Changelog ==
74
 
75
+ = 1.7 =
76
+ * Dropped logic to try and hide the comments link from the Meta widget. Administrators should manually add styling to hide this link, or replace the Meta widget with an alternative.
77
+ * Removed the `disable_comments_allow_persistent_mode` filter. Define `DISABLE_COMMENTS_ALLOW_PERSISTENT_MODE` instead.
78
+
79
  = 1.6 =
80
  * Added a tool for deleting comments in bulk.
81