Version Description
- Added a tool for deleting comments in bulk.
Download this release
Release Info
Developer | solarissmoke |
Plugin | Disable Comments |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.6
- disable-comments.php +28 -10
- includes/settings-page.php +4 -4
- includes/tools-page.php +122 -0
- languages/disable-comments.pot +97 -90
- readme.txt +14 -7
disable-comments.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Disable Comments
|
4 |
-
Plugin URI:
|
5 |
Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type.
|
6 |
-
Version: 1.
|
7 |
Author: Samir Shah
|
8 |
-
Author URI: http://rayofsolaris.net/
|
9 |
License: GPL2
|
10 |
Text Domain: disable-comments
|
11 |
Domain Path: /languages/
|
@@ -163,10 +163,12 @@ class Disable_Comments {
|
|
163 |
if( is_admin() ) {
|
164 |
if( $this->networkactive ) {
|
165 |
add_action( 'network_admin_menu', array( $this, 'settings_menu' ) );
|
|
|
166 |
add_filter( 'network_admin_plugin_action_links', array( $this, 'plugin_actions_links'), 10, 2 );
|
167 |
}
|
168 |
else {
|
169 |
add_action( 'admin_menu', array( $this, 'settings_menu' ) );
|
|
|
170 |
add_filter( 'plugin_action_links', array( $this, 'plugin_actions_links'), 10, 2 );
|
171 |
if( is_multisite() ) // We're on a multisite setup, but the plugin isn't network activated.
|
172 |
register_deactivation_hook( __FILE__, array( $this, 'single_site_deactivate' ) );
|
@@ -183,7 +185,7 @@ class Disable_Comments {
|
|
183 |
|
184 |
if( $this->options['remove_everywhere'] ) {
|
185 |
add_action( 'admin_menu', array( $this, 'filter_admin_menu' ), 9999 ); // do this as late as possible
|
186 |
-
add_action( '
|
187 |
add_action( 'wp_dashboard_setup', array( $this, 'filter_dashboard' ) );
|
188 |
add_filter( 'pre_option_default_pingback_flag', '__return_zero' );
|
189 |
}
|
@@ -299,6 +301,14 @@ jQuery(document).ready(function($){
|
|
299 |
return add_query_arg( 'page', 'disable_comments_settings', $base );
|
300 |
}
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
public function setup_notice(){
|
303 |
if( strpos( get_current_screen()->id, 'settings_page_disable_comments_settings' ) === 0 )
|
304 |
return;
|
@@ -322,11 +332,6 @@ jQuery(document).ready(function($){
|
|
322 |
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
|
323 |
}
|
324 |
|
325 |
-
public function hide_dashboard_bits(){
|
326 |
-
if( 'dashboard' == get_current_screen()->id )
|
327 |
-
add_action( 'admin_print_footer_scripts', array( $this, 'dashboard_js' ) );
|
328 |
-
}
|
329 |
-
|
330 |
public function dashboard_js(){
|
331 |
echo '<script>
|
332 |
jQuery(function($){
|
@@ -374,7 +379,8 @@ jQuery(document).ready(function($){
|
|
374 |
if( $file == $plugin && current_user_can('manage_options') ) {
|
375 |
array_unshift(
|
376 |
$links,
|
377 |
-
sprintf( '<a href="%s">%s</a>', esc_attr( $this->settings_page_url() ), __( 'Settings' ) )
|
|
|
378 |
);
|
379 |
}
|
380 |
|
@@ -393,6 +399,18 @@ jQuery(document).ready(function($){
|
|
393 |
include dirname( __FILE__ ) . '/includes/settings-page.php';
|
394 |
}
|
395 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
private function enter_permanent_mode() {
|
397 |
$types = $this->get_disabled_post_types();
|
398 |
if( empty( $types ) )
|
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.6
|
7 |
Author: Samir Shah
|
8 |
+
Author URI: http://www.rayofsolaris.net/
|
9 |
License: GPL2
|
10 |
Text Domain: disable-comments
|
11 |
Domain Path: /languages/
|
163 |
if( is_admin() ) {
|
164 |
if( $this->networkactive ) {
|
165 |
add_action( 'network_admin_menu', array( $this, 'settings_menu' ) );
|
166 |
+
add_action( 'network_admin_menu', array( $this, 'tools_menu' ) );
|
167 |
add_filter( 'network_admin_plugin_action_links', array( $this, 'plugin_actions_links'), 10, 2 );
|
168 |
}
|
169 |
else {
|
170 |
add_action( 'admin_menu', array( $this, 'settings_menu' ) );
|
171 |
+
add_action( 'admin_menu', array( $this, 'tools_menu' ) );
|
172 |
add_filter( 'plugin_action_links', array( $this, 'plugin_actions_links'), 10, 2 );
|
173 |
if( is_multisite() ) // We're on a multisite setup, but the plugin isn't network activated.
|
174 |
register_deactivation_hook( __FILE__, array( $this, 'single_site_deactivate' ) );
|
185 |
|
186 |
if( $this->options['remove_everywhere'] ) {
|
187 |
add_action( 'admin_menu', array( $this, 'filter_admin_menu' ), 9999 ); // do this as late as possible
|
188 |
+
add_action( 'admin_print_footer_scripts-index.php', array( $this, 'dashboard_js' ) );
|
189 |
add_action( 'wp_dashboard_setup', array( $this, 'filter_dashboard' ) );
|
190 |
add_filter( 'pre_option_default_pingback_flag', '__return_zero' );
|
191 |
}
|
301 |
return add_query_arg( 'page', 'disable_comments_settings', $base );
|
302 |
}
|
303 |
|
304 |
+
/**
|
305 |
+
* Return context-aware tools page URL
|
306 |
+
*/
|
307 |
+
private function tools_page_url() {
|
308 |
+
$base = $this->networkactive ? network_admin_url( 'settings.php' ) : admin_url( 'tools.php' );
|
309 |
+
return add_query_arg( 'page', 'disable_comments_tools', $base );
|
310 |
+
}
|
311 |
+
|
312 |
public function setup_notice(){
|
313 |
if( strpos( get_current_screen()->id, 'settings_page_disable_comments_settings' ) === 0 )
|
314 |
return;
|
332 |
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
|
333 |
}
|
334 |
|
|
|
|
|
|
|
|
|
|
|
335 |
public function dashboard_js(){
|
336 |
echo '<script>
|
337 |
jQuery(function($){
|
379 |
if( $file == $plugin && current_user_can('manage_options') ) {
|
380 |
array_unshift(
|
381 |
$links,
|
382 |
+
sprintf( '<a href="%s">%s</a>', esc_attr( $this->settings_page_url() ), __( 'Settings' ) ),
|
383 |
+
sprintf( '<a href="%s">%s</a>', esc_attr( $this->tools_page_url() ), __( 'Tools' ) )
|
384 |
);
|
385 |
}
|
386 |
|
399 |
include dirname( __FILE__ ) . '/includes/settings-page.php';
|
400 |
}
|
401 |
|
402 |
+
public function tools_menu() {
|
403 |
+
$title = __( 'Delete Comments', 'disable-comments' );
|
404 |
+
if( $this->networkactive )
|
405 |
+
add_submenu_page( 'settings.php', $title, $title, 'manage_network_plugins', 'disable_comments_tools', array( $this, 'tools_page' ) );
|
406 |
+
else
|
407 |
+
add_submenu_page( 'tools.php', $title, $title, 'manage_options', 'disable_comments_tools', array( $this, 'tools_page' ) );
|
408 |
+
}
|
409 |
+
|
410 |
+
public function tools_page() {
|
411 |
+
include dirname( __FILE__ ) . '/includes/tools-page.php';
|
412 |
+
}
|
413 |
+
|
414 |
private function enter_permanent_mode() {
|
415 |
$types = $this->get_disabled_post_types();
|
416 |
if( empty( $types ) )
|
includes/settings-page.php
CHANGED
@@ -56,7 +56,7 @@ if( WP_CACHE )
|
|
56 |
<form action="" method="post" id="disable-comments">
|
57 |
<ul>
|
58 |
<li><label for="remove_everywhere"><input type="radio" id="remove_everywhere" name="mode" value="remove_everywhere" <?php checked( $this->options['remove_everywhere'] );?> /> <strong><?php _e( 'Everywhere', 'disable-comments') ?></strong>: <?php _e( 'Disable all comment-related controls and settings in WordPress.', 'disable-comments') ?></label>
|
59 |
-
<p class="indent"><?php printf( __( '%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>.', 'disable-comments' ), '<strong style="color: #900">' . __('Warning', 'disable-comments') . '</strong>', '
|
60 |
</li>
|
61 |
<li><label for="selected_types"><input type="radio" id="selected_types" name="mode" value="selected_types" <?php checked( ! $this->options['remove_everywhere'] );?> /> <strong><?php _e( 'On certain post types', 'disable-comments') ?></strong>:</label>
|
62 |
<p></p>
|
@@ -65,7 +65,7 @@ if( WP_CACHE )
|
|
65 |
</ul>
|
66 |
<?php if( $this->networkactive ) :?>
|
67 |
<p class="indent" id="extratypes"><?php _e( '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).', 'disable-comments' ); ?>
|
68 |
-
<br /><label
|
69 |
<?php endif; ?>
|
70 |
<p class="indent"><?php _e( '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.', 'disable-comments') ?></p>
|
71 |
</li>
|
@@ -77,7 +77,7 @@ if( WP_CACHE )
|
|
77 |
<li>
|
78 |
<?php
|
79 |
echo '<label for="permanent"><input type="checkbox" name="permanent" id="permanent" '. checked( $this->options['permanent'], true, false ) . '> <strong>' . __( 'Use persistent mode', 'disable-comments') . '</strong></label>';
|
80 |
-
echo '<p class="indent">' . sprintf( __( '%s: <strong>This will make persistent changes to your database — 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.', 'disable-comments'), '<strong style="color: #900">' . __('Warning', 'disable-comments') . '</strong>', '
|
81 |
if( $this->networkactive )
|
82 |
echo '<p class="indent">' . sprintf( __( '%s: Entering persistent mode on large multi-site networks requires a large number of database queries and can take a while. Use with caution!', 'disable-comments'), '<strong style="color: #900">' . __('Warning', 'disable-comments') . '</strong>' ) . '</p>';
|
83 |
?>
|
@@ -86,7 +86,7 @@ if( WP_CACHE )
|
|
86 |
<?php endif; ?>
|
87 |
|
88 |
<?php wp_nonce_field( 'disable-comments-admin' ); ?>
|
89 |
-
<p class="submit"><input class="button-primary" type="submit" name="submit" value="<?php _e( 'Save Changes') ?>"></p>
|
90 |
</form>
|
91 |
</div>
|
92 |
<script>
|
56 |
<form action="" method="post" id="disable-comments">
|
57 |
<ul>
|
58 |
<li><label for="remove_everywhere"><input type="radio" id="remove_everywhere" name="mode" value="remove_everywhere" <?php checked( $this->options['remove_everywhere'] );?> /> <strong><?php _e( 'Everywhere', 'disable-comments') ?></strong>: <?php _e( 'Disable all comment-related controls and settings in WordPress.', 'disable-comments') ?></label>
|
59 |
+
<p class="indent"><?php printf( __( '%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>.', 'disable-comments' ), '<strong style="color: #900">' . __('Warning', 'disable-comments') . '</strong>', 'https://wordpress.org/plugins/disable-comments/other_notes/' ); ?></p>
|
60 |
</li>
|
61 |
<li><label for="selected_types"><input type="radio" id="selected_types" name="mode" value="selected_types" <?php checked( ! $this->options['remove_everywhere'] );?> /> <strong><?php _e( 'On certain post types', 'disable-comments') ?></strong>:</label>
|
62 |
<p></p>
|
65 |
</ul>
|
66 |
<?php if( $this->networkactive ) :?>
|
67 |
<p class="indent" id="extratypes"><?php _e( '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).', 'disable-comments' ); ?>
|
68 |
+
<br /><label><?php _e( 'Custom post types:', 'disable-comments' ); ?> <input type="text" name="extra_post_types" size="30" value="<?php echo implode( ', ', (array) $this->options['extra_post_types'] ); ?>" /></label></p>
|
69 |
<?php endif; ?>
|
70 |
<p class="indent"><?php _e( '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.', 'disable-comments') ?></p>
|
71 |
</li>
|
77 |
<li>
|
78 |
<?php
|
79 |
echo '<label for="permanent"><input type="checkbox" name="permanent" id="permanent" '. checked( $this->options['permanent'], true, false ) . '> <strong>' . __( 'Use persistent mode', 'disable-comments') . '</strong></label>';
|
80 |
+
echo '<p class="indent">' . sprintf( __( '%s: <strong>This will make persistent changes to your database — 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.', 'disable-comments'), '<strong style="color: #900">' . __('Warning', 'disable-comments') . '</strong>', 'https://wordpress.org/plugins/disable-comments/faq/' ) . '</p>';
|
81 |
if( $this->networkactive )
|
82 |
echo '<p class="indent">' . sprintf( __( '%s: Entering persistent mode on large multi-site networks requires a large number of database queries and can take a while. Use with caution!', 'disable-comments'), '<strong style="color: #900">' . __('Warning', 'disable-comments') . '</strong>' ) . '</p>';
|
83 |
?>
|
86 |
<?php endif; ?>
|
87 |
|
88 |
<?php wp_nonce_field( 'disable-comments-admin' ); ?>
|
89 |
+
<p class="submit"><input class="button-primary" type="submit" name="submit" value="<?php _e( 'Save Changes', 'disable-comments') ?>"></p>
|
90 |
</form>
|
91 |
</div>
|
92 |
<script>
|
includes/tools-page.php
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if( !defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
?>
|
6 |
+
<div class="wrap">
|
7 |
+
<h1><?php _e( 'Delete Comments', 'disable-comments') ?></h1>
|
8 |
+
<?php
|
9 |
+
|
10 |
+
global $wpdb;
|
11 |
+
$comments_count = $wpdb->get_var("SELECT count(comment_id) from $wpdb->comments");
|
12 |
+
if ( $comments_count <= 0 ) { ?>
|
13 |
+
<p><strong><?php _e( 'No comments available for deletion.', 'disable-comments') ?></strong></p>
|
14 |
+
</div>
|
15 |
+
<?php
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
|
19 |
+
$typeargs = array( 'public' => true );
|
20 |
+
if( $this->networkactive ) {
|
21 |
+
$typeargs['_builtin'] = true; // stick to known types for network
|
22 |
+
}
|
23 |
+
$types = get_post_types( $typeargs, 'objects' );
|
24 |
+
foreach( array_keys( $types ) as $type ) {
|
25 |
+
if( ! in_array( $type, $this->modified_types ) && ! post_type_supports( $type, 'comments' ) ) // the type doesn't support comments anyway
|
26 |
+
unset( $types[$type] );
|
27 |
+
}
|
28 |
+
|
29 |
+
if ( isset( $_POST['delete'] ) && isset( $_POST['delete_mode'] ) ) {
|
30 |
+
check_admin_referer( 'delete-comments-admin' );
|
31 |
+
|
32 |
+
if( $_POST['delete_mode'] == 'delete_everywhere' ) {
|
33 |
+
if ( $wpdb->query( "TRUNCATE $wpdb->commentmeta" ) != FALSE ){
|
34 |
+
if ( $wpdb->query( "TRUNCATE $wpdb->comments" ) != FALSE ){
|
35 |
+
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = 0 WHERE post_author != 0" );
|
36 |
+
$wpdb->query( "OPTIMIZE TABLE $wpdb->commentmeta" );
|
37 |
+
$wpdb->query( "OPTIMIZE TABLE $wpdb->comments" );
|
38 |
+
echo "<p style='color:green'><strong>" . __( 'All comments have been deleted.', 'disable-comments' ) . "</strong></p>";
|
39 |
+
} else {
|
40 |
+
echo "<p style='color:red'><strong>" . __( 'Internal error occured. Please try again later.', 'disable-comments' ) . "</strong></p>";
|
41 |
+
}
|
42 |
+
} else {
|
43 |
+
echo "<p style='color:red'><strong>" . __( 'Internal error occured. Please try again later.', 'disable-comments' ) . "</strong></p>";
|
44 |
+
}
|
45 |
+
} else {
|
46 |
+
$delete_post_types = empty( $_POST['delete_types'] ) ? array() : (array) $_POST['delete_types'];
|
47 |
+
$delete_post_types = array_intersect( $delete_post_types, array_keys( $types ) );
|
48 |
+
|
49 |
+
// Extra custom post types
|
50 |
+
if( $this->networkactive && !empty( $_POST['delete_extra_post_types'] ) ) {
|
51 |
+
$delete_extra_post_types = array_filter( array_map( 'sanitize_key', explode( ',', $_POST['delete_extra_post_types'] ) ) );
|
52 |
+
$delete_extra_post_types = array_diff( $delete_extra_post_types, array_keys( $types ) ); // Make sure we don't double up builtins
|
53 |
+
$delete_post_types = array_merge($delete_post_types, $delete_extra_post_types);
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( ! empty( $delete_post_types ) ) {
|
57 |
+
// Loop through post_types and remove comments/meta and set posts comment_count to 0
|
58 |
+
foreach ( $delete_post_types as $delete_post_type ) {
|
59 |
+
$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'" );
|
60 |
+
$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'" );
|
61 |
+
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = 0 WHERE post_author != 0 AND post_type = '$delete_post_type'" );
|
62 |
+
echo "<p style='color:green'><strong>" . sprintf( __( 'All comments have been deleted for %ss.', 'disable-comments' ), $delete_post_type ) . "</strong></p>";
|
63 |
+
}
|
64 |
+
|
65 |
+
$wpdb->query( "OPTIMIZE TABLE $wpdb->commentmeta" );
|
66 |
+
$wpdb->query( "OPTIMIZE TABLE $wpdb->comments" );
|
67 |
+
|
68 |
+
echo "<h4 style='color:green'><strong>" . __( 'Comment Deletion Complete', 'disable-comments') . "</strong></h4>";
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
$comments_count = $wpdb->get_var("SELECT count(comment_id) from $wpdb->comments");
|
74 |
+
if ( $comments_count <= 0 ) { ?>
|
75 |
+
<p><strong><?php _e( 'No comments available for deletion.', 'disable-comments') ?></strong></p>
|
76 |
+
</div>
|
77 |
+
<?php
|
78 |
+
return;
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
82 |
+
?>
|
83 |
+
<form action="" method="post" id="delete-comments">
|
84 |
+
<ul>
|
85 |
+
<li><label for="delete_everywhere"><input type="radio" id="delete_everywhere" name="delete_mode" value="delete_everywhere" <?php checked( $this->options['remove_everywhere'] );?> /> <strong><?php _e( 'Everywhere', 'disable-comments') ?></strong>: <?php _e( 'Delete all comments in WordPress.', 'disable-comments') ?></label>
|
86 |
+
<p class="indent"><?php printf( __( '%s: This function and will affect your entire site. Use it only if you want to delete comments <em>everywhere</em>.', 'disable-comments' ), '<strong style="color: #900">' . __('Warning', 'disable-comments') . '</strong>' ); ?></p>
|
87 |
+
</li>
|
88 |
+
<li><label for="selected_delete_types"><input type="radio" id="selected_delete_types" name="delete_mode" value="selected_delete_types" <?php checked( ! $this->options['remove_everywhere'] );?> /> <strong><?php _e( 'For certain post types', 'disable-comments') ?></strong>:</label>
|
89 |
+
<p></p>
|
90 |
+
<ul class="indent" id="listofdeletetypes">
|
91 |
+
<?php foreach( $types as $k => $v ) echo "<li><label for='post-type-$k'><input type='checkbox' name='delete_types[]' value='$k' ". checked( in_array( $k, $this->options['disabled_post_types'] ), true, false ) ." id='post-type-$k'> {$v->labels->name}</label></li>";?>
|
92 |
+
</ul>
|
93 |
+
<?php if( $this->networkactive ) :?>
|
94 |
+
<p class="indent" id="extradeletetypes"><?php _e( '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).', 'disable-comments' ); ?>
|
95 |
+
<br /><label><?php _e( 'Custom post types:', 'disable-comments' ); ?> <input type="text" name="delete_extra_post_types" size="30" value="<?php echo implode( ', ', (array) $this->options['extra_post_types'] ); ?>" /></label></p>
|
96 |
+
<?php endif; ?>
|
97 |
+
<p class="indent"><?php printf( __( '%s: Deleting comments will remove existing comment entries in the database and cannot be reverted without a database backup.', 'disable-comments'), '<strong style="color: #900">' . __('Warning', 'disable-comments') . '</strong>' ); ?></p>
|
98 |
+
</li>
|
99 |
+
</ul>
|
100 |
+
|
101 |
+
<?php wp_nonce_field( 'delete-comments-admin' ); ?>
|
102 |
+
<h4><?php _e( 'Total Comments:', 'disable-comments' ); ?> <?php echo $comments_count; ?></h4>
|
103 |
+
<p class="submit"><input class="button-primary" type="submit" name="delete" value="<?php _e( 'Delete Comments', 'disable-comments') ?>"></p>
|
104 |
+
</form>
|
105 |
+
</div>
|
106 |
+
<script>
|
107 |
+
jQuery(document).ready(function($){
|
108 |
+
function delete_comments_uihelper(){
|
109 |
+
var toggle_bits = $("#listofdeletetypes, #extradeletetypes");
|
110 |
+
if( $("#delete_everywhere").is(":checked") )
|
111 |
+
toggle_bits.css("color", "#888").find(":input").attr("disabled", true );
|
112 |
+
else
|
113 |
+
toggle_bits.css("color", "#000").find(":input").attr("disabled", false );
|
114 |
+
}
|
115 |
+
|
116 |
+
$("#delete-comments :input").change(function(){
|
117 |
+
delete_comments_uihelper();
|
118 |
+
});
|
119 |
+
|
120 |
+
delete_comments_uihelper();
|
121 |
+
});
|
122 |
+
</script>
|
languages/disable-comments.pot
CHANGED
@@ -1,164 +1,171 @@
|
|
1 |
-
# Copyright (C)
|
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 |
-
"Report-Msgid-Bugs-To:
|
7 |
-
"POT-Creation-Date:
|
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:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
-
#: disable-comments.php:
|
16 |
msgid "Disable Comments requires WordPress version %s or greater."
|
17 |
msgstr ""
|
18 |
|
19 |
-
#: disable-comments.php:
|
20 |
-
msgid ""
|
21 |
-
"Note: The <em>Disable Comments</em> plugin is currently active, and comments "
|
22 |
-
"are completely disabled on: %s. Many of the settings below will not be "
|
23 |
-
"applicable for those post types."
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: disable-comments.php:
|
27 |
-
msgid ", "
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: disable-comments.php:
|
31 |
-
msgid ""
|
32 |
-
"The <em>Disable Comments</em> plugin is active, but isn't configured to do "
|
33 |
-
"anything yet. Visit the <a href=\"%s\">configuration page</a> to choose "
|
34 |
-
"which post types to disable comments on."
|
35 |
msgstr ""
|
36 |
|
37 |
-
#: disable-comments.php:
|
38 |
-
msgid "Comments
|
39 |
msgstr ""
|
40 |
|
41 |
-
#: disable-comments.php:
|
42 |
msgid "Settings"
|
43 |
msgstr ""
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
msgid "Disable Comments"
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: disable-comments.php:
|
52 |
-
|
53 |
-
"
|
54 |
-
"ensure that changes are reflected immediately."
|
55 |
msgstr ""
|
56 |
|
57 |
-
#:
|
58 |
-
msgid ""
|
59 |
-
"Options updated. Changes to the Admin Menu and Admin Bar will not appear "
|
60 |
-
"until you leave or reload this page."
|
61 |
msgstr ""
|
62 |
|
63 |
-
#:
|
64 |
-
msgid ""
|
65 |
-
"<em>Disable Comments</em> is Network Activated. The settings below will "
|
66 |
-
"affect <strong>all sites</strong> in this network."
|
67 |
msgstr ""
|
68 |
|
69 |
-
#:
|
70 |
-
msgid ""
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
74 |
msgstr ""
|
75 |
|
76 |
-
#:
|
77 |
msgid "Everywhere"
|
78 |
msgstr ""
|
79 |
|
80 |
-
#:
|
81 |
msgid "Disable all comment-related controls and settings in WordPress."
|
82 |
msgstr ""
|
83 |
|
84 |
-
#:
|
85 |
-
msgid ""
|
86 |
-
"%s: This option is global and will affect your entire site. Use it only if "
|
87 |
-
"you want to disable comments <em>everywhere</em>. A complete description of "
|
88 |
-
"what this option does is <a href=\"%s\" target=\"_blank\">available here</a>."
|
89 |
msgstr ""
|
90 |
|
91 |
-
#:
|
92 |
-
#:
|
|
|
93 |
msgid "Warning"
|
94 |
msgstr ""
|
95 |
|
96 |
-
#:
|
97 |
msgid "On certain post types"
|
98 |
msgstr ""
|
99 |
|
100 |
-
#:
|
101 |
-
msgid ""
|
102 |
-
"Only the built-in post types appear above. If you want to disable comments "
|
103 |
-
"on other custom post types on the entire network, you can supply a comma-"
|
104 |
-
"separated list of post types below (use the slug that identifies the post "
|
105 |
-
"type)."
|
106 |
msgstr ""
|
107 |
|
108 |
-
#:
|
109 |
-
msgid ""
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
113 |
msgstr ""
|
114 |
|
115 |
-
#:
|
116 |
msgid "Other options"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#:
|
120 |
msgid "Use persistent mode"
|
121 |
msgstr ""
|
122 |
|
123 |
-
#:
|
124 |
-
msgid ""
|
125 |
-
"%s: <strong>This will make persistent changes to your database — "
|
126 |
-
"comments will remain closed even if you later disable the plugin!</strong> "
|
127 |
-
"You should not use it if you only want to disable comments temporarily. "
|
128 |
-
"Please <a href=\"%s\" target=\"_blank\">read the FAQ</a> before selecting "
|
129 |
-
"this option."
|
130 |
msgstr ""
|
131 |
|
132 |
-
#:
|
133 |
-
msgid ""
|
134 |
-
"%s: Entering persistent mode on large multi-site networks requires a large "
|
135 |
-
"number of database queries and can take a while. Use with caution!"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#:
|
139 |
msgid "Save Changes"
|
140 |
msgstr ""
|
141 |
|
142 |
-
#:
|
143 |
-
msgid ""
|
144 |
-
"%s: Selecting this option will make persistent changes to your database. Are "
|
145 |
-
"you sure you want to enable it?"
|
146 |
msgstr ""
|
147 |
|
148 |
-
|
149 |
-
msgid "
|
150 |
msgstr ""
|
151 |
|
152 |
-
|
153 |
-
msgid ""
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
msgstr ""
|
157 |
|
158 |
-
|
159 |
-
msgid "
|
160 |
msgstr ""
|
161 |
|
162 |
-
|
163 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
msgstr ""
|
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 |
|
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 "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
|
28 |
+
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
|
36 |
msgid "Settings"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: disable-comments.php:383
|
40 |
+
msgid "Tools"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: disable-comments.php:391 includes/settings-page.php:49
|
44 |
msgid "Disable Comments"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: disable-comments.php:403 includes/tools-page.php:7
|
48 |
+
#: includes/tools-page.php:103
|
49 |
+
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
|
69 |
msgid "Everywhere"
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: includes/settings-page.php:58
|
73 |
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
|
81 |
+
#: includes/settings-page.php:82 includes/settings-page.php:110
|
82 |
+
#: includes/tools-page.php:86 includes/tools-page.php:97
|
83 |
msgid "Warning"
|
84 |
msgstr ""
|
85 |
|
86 |
+
#: includes/settings-page.php:61
|
87 |
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
|
95 |
+
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
|
103 |
msgid "Other options"
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: includes/settings-page.php:79
|
107 |
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 — 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
|
119 |
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
|
127 |
+
msgid "No comments available for deletion."
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: includes/tools-page.php:38
|
131 |
+
msgid "All comments have been deleted."
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: includes/tools-page.php:40 includes/tools-page.php:43
|
135 |
+
msgid "Internal error occured. Please try again later."
|
136 |
+
msgstr ""
|
137 |
+
|
138 |
+
#: includes/tools-page.php:62
|
139 |
+
msgid "All comments have been deleted for %ss."
|
140 |
+
msgstr ""
|
141 |
+
|
142 |
+
#: includes/tools-page.php:68
|
143 |
+
msgid "Comment Deletion Complete"
|
144 |
+
msgstr ""
|
145 |
+
|
146 |
+
#: includes/tools-page.php:85
|
147 |
+
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
|
155 |
+
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 ""
|
readme.txt
CHANGED
@@ -3,10 +3,10 @@ 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 |
Stable tag: trunk
|
8 |
|
9 |
-
Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. Multisite friendly.
|
10 |
|
11 |
== Description ==
|
12 |
|
@@ -14,9 +14,9 @@ This plugin allows administrators to globally disable comments on any post type
|
|
14 |
|
15 |
Additionally, comment-related items can be removed from the Dashboard, Widgets, the Admin Menu and the Admin Bar.
|
16 |
|
17 |
-
**Important note**: Use this plugin if you don't want comments at all on your site (or on certain post types). Don't use it if you want to selectively disable comments on individual posts - WordPress lets you do that anyway. If you don't know how to disable comments on individual posts, there are instructions in [the FAQ](
|
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](
|
20 |
|
21 |
Want to contribute? Here's the [GitHub development repository](https://github.com/solarissmoke/disable-comments).
|
22 |
|
@@ -28,7 +28,7 @@ A [must-use version](https://github.com/solarissmoke/disable-comments-mu) of the
|
|
28 |
|
29 |
This is because your theme is not checking the comment status of posts in the correct way.
|
30 |
|
31 |
-
You may like to point your theme's author to [this explanation](http://rayofsolaris.net/blog/2012/how-to-check-if-comments-are-allowed-in-wordpress) of what they are doing wrong, and how to fix it.
|
32 |
|
33 |
= How can I remove the text that says "comments are closed" at the bottom of articles where comments are disabled? =
|
34 |
|
@@ -42,7 +42,11 @@ Don't install this plugin!
|
|
42 |
|
43 |
Go to the edit page for the post you want to disable comments on. Scroll down to the "Discussion" box, where you will find the comment options for that post. If you don't see a "Discussion" box, then click on "Screen Options" at the top of your screen, and make sure the "Discussion" checkbox is checked.
|
44 |
|
45 |
-
You can also bulk-edit the comment status of multiple posts from the [posts screen](
|
|
|
|
|
|
|
|
|
46 |
|
47 |
== Details ==
|
48 |
|
@@ -56,7 +60,7 @@ The plugin provides the option to **completely disable the commenting feature in
|
|
56 |
* The X-Pingback HTTP header is removed from all pages;
|
57 |
* Outgoing pingbacks are disabled.
|
58 |
|
59 |
-
**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.**
|
60 |
|
61 |
== Advanced Configuration ==
|
62 |
|
@@ -68,6 +72,9 @@ These definitions can be made either in your main `wp-config.php` or in your the
|
|
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.
|
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.
|
10 |
|
11 |
== Description ==
|
12 |
|
14 |
|
15 |
Additionally, comment-related items can be removed from the Dashboard, Widgets, the Admin Menu and the Admin Bar.
|
16 |
|
17 |
+
**Important note**: Use this plugin if you don't want comments at all on your site (or on certain post types). Don't use it if you want to selectively disable comments on individual posts - WordPress lets you do that anyway. If you don't know how to disable comments on individual posts, there are instructions in [the FAQ](https://wordpress.org/plugins/disable-comments/faq/).
|
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 |
|
28 |
|
29 |
This is because your theme is not checking the comment status of posts in the correct way.
|
30 |
|
31 |
+
You may like to point your theme's author to [this explanation](http://www.rayofsolaris.net/blog/2012/how-to-check-if-comments-are-allowed-in-wordpress/) of what they are doing wrong, and how to fix it.
|
32 |
|
33 |
= How can I remove the text that says "comments are closed" at the bottom of articles where comments are disabled? =
|
34 |
|
42 |
|
43 |
Go to the edit page for the post you want to disable comments on. Scroll down to the "Discussion" box, where you will find the comment options for that post. If you don't see a "Discussion" box, then click on "Screen Options" at the top of your screen, and make sure the "Discussion" checkbox is checked.
|
44 |
|
45 |
+
You can also bulk-edit the comment status of multiple posts from the [posts screen](https://codex.wordpress.org/Posts_Screen).
|
46 |
+
|
47 |
+
= I want to delete comments from my database. What do I do? =
|
48 |
+
|
49 |
+
Go to the settings 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 |
|
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 |
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 1.6 =
|
76 |
+
* Added a tool for deleting comments in bulk.
|
77 |
+
|
78 |
= 1.5.2 =
|
79 |
* Fix Javascript errors when the Meta widget is enabled.
|
80 |
* Hide comments link from the Welcome panel.
|