Disable Comments - Version 1.5.2

Version Description

  • Fix Javascript errors when the Meta widget is enabled.
  • Hide comments link from the Welcome panel.
Download this release

Release Info

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

Code changes from version 1.5.1 to 1.5.2

Files changed (2) hide show
  1. disable-comments.php +11 -14
  2. readme.txt +4 -0
disable-comments.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Disable Comments
4
  Plugin URI: http://wordpress.org/extend/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.5.1
7
  Author: Samir Shah
8
  Author URI: http://rayofsolaris.net/
9
  License: GPL2
@@ -52,11 +52,11 @@ class Disable_Comments {
52
  }
53
 
54
  private function check_compatibility() {
55
- if ( version_compare( $GLOBALS['wp_version'], '3.7', '<' ) ) {
56
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
57
  deactivate_plugins( __FILE__ );
58
  if ( isset( $_GET['action'] ) && ( $_GET['action'] == 'activate' || $_GET['action'] == 'error_scrape' ) ) {
59
- exit( sprintf( __( 'Disable Comments requires WordPress version %s or greater.', 'disable-comments' ), '3.6' ) );
60
  }
61
  }
62
  }
@@ -194,7 +194,7 @@ class Disable_Comments {
194
 
195
  if( $this->options['remove_everywhere'] ) {
196
  add_filter( 'feed_links_show_comments_feed', '__return_false' );
197
- add_action( 'wp_footer', array( $this, 'hide_meta_widget_link' ) );
198
  }
199
  }
200
  }
@@ -245,8 +245,7 @@ class Disable_Comments {
245
  public function filter_admin_bar() {
246
  if( is_admin_bar_showing() ) {
247
  // Remove comments links from admin bar
248
- remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 ); // WP<3.3
249
- remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 ); // WP 3.3
250
  if( is_multisite() ) {
251
  add_action( 'admin_bar_menu', array( $this, 'remove_network_comment_links' ), 500 );
252
  }
@@ -329,13 +328,12 @@ jQuery(document).ready(function($){
329
  }
330
 
331
  public function dashboard_js(){
332
- if( version_compare( $GLOBALS['wp_version'], '3.8', '<' ) ) {
333
- // getting hold of the discussion box is tricky. The table_discussion class is used for other things in multisite
334
- echo '<script> jQuery(function($){ $("#dashboard_right_now .table_discussion").has(\'a[href="edit-comments.php"]\').first().hide(); }); </script>';
335
- }
336
- else {
337
- echo '<script> jQuery(function($){ $("#dashboard_right_now .comment-count, #latest-comments").hide(); }); </script>';
338
- }
339
  }
340
 
341
  public function hide_meta_widget_link(){
@@ -355,7 +353,6 @@ jQuery(document).ready(function($){
355
  }
356
 
357
  public function disable_rc_widget() {
358
- // This widget has been removed from the Dashboard in WP 3.8 and can be removed in a future version
359
  unregister_widget( 'WP_Widget_Recent_Comments' );
360
  }
361
 
3
  Plugin Name: Disable Comments
4
  Plugin URI: http://wordpress.org/extend/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.5.2
7
  Author: Samir Shah
8
  Author URI: http://rayofsolaris.net/
9
  License: GPL2
52
  }
53
 
54
  private function check_compatibility() {
55
+ if ( version_compare( $GLOBALS['wp_version'], '3.8', '<' ) ) {
56
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
57
  deactivate_plugins( __FILE__ );
58
  if ( isset( $_GET['action'] ) && ( $_GET['action'] == 'activate' || $_GET['action'] == 'error_scrape' ) ) {
59
+ exit( sprintf( __( 'Disable Comments requires WordPress version %s or greater.', 'disable-comments' ), '3.8' ) );
60
  }
61
  }
62
  }
194
 
195
  if( $this->options['remove_everywhere'] ) {
196
  add_filter( 'feed_links_show_comments_feed', '__return_false' );
197
+ add_action( 'wp_footer', array( $this, 'hide_meta_widget_link' ), 100 );
198
  }
199
  }
200
  }
245
  public function filter_admin_bar() {
246
  if( is_admin_bar_showing() ) {
247
  // Remove comments links from admin bar
248
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
 
249
  if( is_multisite() ) {
250
  add_action( 'admin_bar_menu', array( $this, 'remove_network_comment_links' ), 500 );
251
  }
328
  }
329
 
330
  public function dashboard_js(){
331
+ echo '<script>
332
+ jQuery(function($){
333
+ $("#dashboard_right_now .comment-count, #latest-comments").hide();
334
+ $("#welcome-panel .welcome-comments").parent().hide();
335
+ });
336
+ </script>';
 
337
  }
338
 
339
  public function hide_meta_widget_link(){
353
  }
354
 
355
  public function disable_rc_widget() {
 
356
  unregister_widget( 'WP_Widget_Recent_Comments' );
357
  }
358
 
readme.txt CHANGED
@@ -68,6 +68,10 @@ These definitions can be made either in your main `wp-config.php` or in your the
68
 
69
  == Changelog ==
70
 
 
 
 
 
71
  = 1.5.1 =
72
  * Hide existing comments if there are any.
73
  * Filter the comments link in the Meta widget if it is enabled.
68
 
69
  == Changelog ==
70
 
71
+ = 1.5.2 =
72
+ * Fix Javascript errors when the Meta widget is enabled.
73
+ * Hide comments link from the Welcome panel.
74
+
75
  = 1.5.1 =
76
  * Hide existing comments if there are any.
77
  * Filter the comments link in the Meta widget if it is enabled.