No Page Comment - Version 1.0.1

Version Description

  • FIX: Added missing files from failed SVN commit.
Download this release

Release Info

Developer sethta
Plugin Icon 128x128 No Page Comment
Version 1.0.1
Comparing to
See all releases

Code changes from version 0.3 to 1.0.1

Files changed (4) hide show
  1. no-page-comment-settings.php +128 -0
  2. no-page-comment.css +73 -0
  3. no-page-comment.php +211 -177
  4. readme.txt +37 -12
no-page-comment-settings.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" class="wrap">
3
+
4
+ <?php
5
+ // Prints out the admin settings page
6
+ $sta_npc_nonce = wp_create_nonce('sta_npc_nonce');
7
+ $sta_npc_options = $this->sta_npc_get_admin_options();
8
+
9
+ if ( isset($_POST['update_sta_npc_plugin_settings']) ) {
10
+
11
+ foreach ( get_post_types('','objects') as $posttype ) {
12
+ if ( in_array( $posttype->name, $this->excluded_posttypes ) )
13
+ continue;
14
+
15
+ if ( isset($_POST['sta_npc_disable_comments_' . $posttype->name]) ) {
16
+ $sta_npc_options['disable_comments_' . $posttype->name] = $_POST['sta_npc_disable_comments_' . $posttype->name];
17
+ } else {
18
+ $sta_npc_options['disable_comments_' . $posttype->name] = 'false';
19
+ }
20
+
21
+ if ( isset($_POST['sta_npc_disable_trackbacks_' . $posttype->name]) ) {
22
+ $sta_npc_options['disable_trackbacks_' . $posttype->name] = $_POST['sta_npc_disable_trackbacks_' . $posttype->name];
23
+ } else {
24
+ $sta_npc_options['disable_trackbacks_' . $posttype->name] = 'false';
25
+ }
26
+
27
+ } // end foreach post types
28
+
29
+ update_option($this->admin_options_name, $sta_npc_options);
30
+ ?>
31
+ <div class="updated"><p><strong><?php _e('Settings Updated.', $this->plugin_domain ); ?></strong></p></div>
32
+ <?php } ?>
33
+
34
+ <div id="icon-options-general" class="icon32"></div>
35
+ <h2><?php _e( 'No Page Comment Settings', $this->plugin_domain ); ?></h2>
36
+
37
+ <div id="poststuff">
38
+ <div id="post-body" class="metabox-holder columns-2">
39
+
40
+ <div id="post-body-content">
41
+ <div class="meta-box-sortables ui-sortable">
42
+
43
+ <div class="postbox">
44
+ <h3 style="cursor:default;"><span><?php _e('Disable comments on new:', $this->plugin_domain ); ?></span></h3>
45
+ <div class="inside">
46
+ <?php foreach ( get_post_types('','objects') as $posttype ) {
47
+ if ( in_array( $posttype->name, $this->excluded_posttypes ) )
48
+ continue; ?>
49
+ <div>
50
+ <strong class="post-type"><?php echo $posttype->label; ?></strong>
51
+ <div class="inner">
52
+ <label for="sta_npc_disable_comments_<?php echo $posttype->name; ?>">
53
+ <input type="checkbox" id="sta_npc_disable_comments_<?php echo $posttype->name; ?>" name="sta_npc_disable_comments_<?php echo $posttype->name; ?>" value="true" <?php if ( $sta_npc_options['disable_comments_' . $posttype->name] == 'true' ) { _e('checked="checked"', $this->plugin_domain ); } ?>> <?php _e('Comments', $this->plugin_domain ); ?></label>
54
+ <label for="sta_npc_disable_trackbacks_<?php echo $posttype->name; ?>">
55
+ <input type="checkbox" id="sta_npc_disable_trackbacks_<?php echo $posttype->name; ?>" name="sta_npc_disable_trackbacks_<?php echo $posttype->name; ?>" value="true" <?php if ( $sta_npc_options['disable_trackbacks_' . $posttype->name] == 'true' ) { _e('checked="checked"', $this->plugin_domain ); } ?>> <?php _e('Trackbacks', $this->plugin_domain ); ?></label>
56
+ </div>
57
+ </div>
58
+ <br class="clear">
59
+ <?php } ?>
60
+ </div>
61
+ </div>
62
+ <p class="submit">
63
+ <input type="submit" name="update_sta_npc_plugin_settings" id="submit" class="button-primary" value="<?php _e('Update Settings', $this->plugin_domain ); ?>">
64
+ </p>
65
+
66
+ </div>
67
+ <div class="meta-box-sortables ui-sortable">
68
+
69
+ <div class="postbox">
70
+ <h3 style="cursor:default;"><span><?php _e('Modify all current:', $this->plugin_domain ); ?></span></h3>
71
+ <div class="inside buttons">
72
+ <?php foreach ( get_post_types('','objects') as $posttype ) {
73
+ if ( in_array( $posttype->name, $this->excluded_posttypes ) )
74
+ continue; ?>
75
+ <div>
76
+ <strong class="post-type"><?php echo $posttype->label; ?></strong>
77
+ <div class="inner">
78
+ <div>
79
+ <input type="submit" name="disable_all_<?php echo $posttype->name; ?>_comments" class="button-primary sta_ajax_modify" data-nonce="<?php echo $sta_npc_nonce; ?>" data-post_type="<?php echo $posttype->name; ?>" data-post_label="<?php echo $posttype->label; ?>" data-comment_status="open" data-comment_type="comment" value="<?php _e('Disable All Comments', $this->plugin_domain ); ?>">
80
+ <input type="submit" name="enable_all_<?php echo $posttype->name; ?>_comments" class="button-primary sta_ajax_modify" data-nonce="<?php echo $sta_npc_nonce; ?>" data-post_type="<?php echo $posttype->name; ?>" data-post_label="<?php echo $posttype->label; ?>" data-comment_status="closed" data-comment_type="comment" value="<?php _e('Enable All Comments', $this->plugin_domain ); ?>">
81
+ </div>
82
+ <div>
83
+ <input type="submit" name="disable_all_<?php echo $posttype->name; ?>_trackbacks" class="button-primary sta_ajax_modify" data-nonce="<?php echo $sta_npc_nonce; ?>" data-post_type="<?php echo $posttype->name; ?>" data-post_label="<?php echo $posttype->label; ?>" data-comment_status="open" data-comment_type="ping" value="<?php _e('Disable All Trackbacks', $this->plugin_domain ); ?>">
84
+ <input type="submit" name="enable_all_<?php echo $posttype->name; ?>_trackbacks" class="button-primary sta_ajax_modify" data-nonce="<?php echo $sta_npc_nonce; ?>" data-post_type="<?php echo $posttype->name; ?>" data-post_label="<?php echo $posttype->label; ?>" data-comment_status="closed" data-comment_type="ping" value="<?php _e('Enable All Trackbacks', $this->plugin_domain ); ?>">
85
+ </div>
86
+ </div>
87
+ </div>
88
+ <br class="clear">
89
+ <?php } ?>
90
+ </div>
91
+
92
+ </div>
93
+
94
+ </div>
95
+ </div>
96
+
97
+ <div id="postbox-container-1" class="postbox-container">
98
+ <div class="meta-box-sortables">
99
+
100
+ <div class="postbox">
101
+ <h3 style="cursor:default;"><span><?php _e('Other plugins by', $this->plugin_domain ); ?> <a href="http://sethalling.com/" title="<?php _e('Seth Alling', $this->plugin_domain ); ?>" style="font-size:15px;"><?php _e('Seth Alling', $this->plugin_domain ); ?></a>:</span></h3>
102
+ <div class="inside">
103
+ <ul>
104
+ <li style="padding:5px 0;"><a href="http://sethalling.com/plugins/wordpress/wp-faqs-pro" title="<?php _e('WP FAQs Pro', $this->plugin_domain ); ?>"><?php _e('WP FAQs Pro', $this->plugin_domain ); ?></a></li>
105
+ </ul>
106
+ </div>
107
+ </div>
108
+
109
+ <div class="postbox">
110
+ <h3 style="cursor:default;"><span><?php _e('Support No Page Comment:', $this->plugin_domain ); ?></span></h3>
111
+ <div class="inside">
112
+ <ul>
113
+ <li style="padding:5px 0;"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5WWP2EDSCAJR4" title="<?php _e('Donate to support the No Page Comment plugin development', $this->plugin_domain ); ?>"><?php _e('Donate', $this->plugin_domain ); ?></a></li>
114
+ <li style="padding:5px 0;"><a href="http://wordpress.org/support/view/plugin-reviews/no-page-comment#postform" title="<?php _e('Write a Review about No Page Comment', $this->plugin_domain ); ?>"><?php _e('Write a Review', $this->plugin_domain ); ?></a></li>
115
+ <li style="padding:5px 0;"><a href="https://github.com/sethta/no-page-comment" title="<?php _e('Fork No Page Comment on Github', $this->plugin_domain ); ?>"><?php _e('Fork No Page Comment', $this->plugin_domain ); ?></a></li>
116
+ <li style="padding:5px 0;"><a href="https://github.com/sethta/no-page-comment/issues" title="<?php _e('Report an Issue on Github', $this->plugin_domain ); ?>"><?php _e('Report an Issue about No Page Comment', $this->plugin_domain ); ?></a></li>
117
+ </ul>
118
+ </div>
119
+ </div>
120
+
121
+ </div>
122
+ </div>
123
+
124
+ </div>
125
+ <br class="clear">
126
+ </div>
127
+
128
+ </form>
no-page-comment.css ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .inside > div {
2
+ padding: 10px 0 0;
3
+ float: left;
4
+ width: 100%;
5
+ }
6
+ .inside .post-type {
7
+ width: 20%;
8
+ min-width: 120px;
9
+ margin-bottom: 10px;
10
+ float: left;
11
+ }
12
+ .inner {
13
+ float: left;
14
+ width: 80%;
15
+ }
16
+ .inner > div {
17
+ float: left;
18
+ width: 50%;
19
+ }
20
+ .inner label {
21
+ padding-right: 50px;
22
+ margin-bottom: 10px;
23
+ float:left;
24
+ }
25
+ .buttons input {
26
+ margin:0 1% 5px !important;
27
+ float:left;
28
+ width: 47%;
29
+ min-width: 150px;
30
+ }
31
+
32
+ @media (max-width: 1200px) {
33
+ .inside .post-type {
34
+ width: 30%;
35
+ }
36
+ .inner {
37
+ width: 70%;
38
+ }
39
+ .buttons .post-type {
40
+ min-width: 200px;
41
+ }
42
+ .buttons .inner {
43
+ width: 100%;
44
+ }
45
+ }
46
+
47
+ @media (max-width: 1152px) {
48
+ .buttons input {
49
+ margin:0 1% 5px !important;
50
+ width: 97%;
51
+ }
52
+ }
53
+
54
+ @media (max-width: 600px) {
55
+ .buttons input {
56
+ margin:0 1% 5px !important;
57
+ width: 97%;
58
+ }
59
+ }
60
+
61
+ @media (max-width: 380px) {
62
+ .inside .post-type {
63
+ min-width: 200px;
64
+ }
65
+ .inner > div {
66
+ width: 100%;
67
+ margin-bottom: 5px;
68
+ }
69
+ .buttons input {
70
+ margin:0 0 5px !important;
71
+ width: 100%;
72
+ }
73
+ }
no-page-comment.php CHANGED
@@ -3,11 +3,11 @@
3
  Plugin Name: No Page Comment
4
  Plugin URI: http://sethalling.com/plugins/no-page-comment
5
  Description: A plugin that uses javascript to disable comments by default on posts, pages and/or custom post types but leave them enabled on others, while still giving you the ability to individually set them on a page or post basis.
6
- Version: 0.3
7
  Author: Seth Alling
8
  Author URI: http://sethalling.com/
9
 
10
- Plugin: Copyright (c) 2011-2013 Seth Alling
11
 
12
  This program is free software; you can redistribute it and/or
13
  modify it under the terms of the GNU General Public License
@@ -22,46 +22,53 @@ Author URI: http://sethalling.com/
22
  You should have received a copy of the GNU General Public License
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 
 
 
 
 
 
 
25
  */
26
 
27
- register_activation_hook(__FILE__, 'sta_npc_activate');
28
 
29
- if ( ! function_exists('sta_npc_activate') ) {
 
 
30
  function sta_npc_activate() {
31
  sta_npc_load();
32
  global $sta_npc_plugin;
33
- $sta_npc_plugin->sta_npc_activate();
34
  }
35
  }
36
 
37
- if ( ! function_exists('sta_npc_load') ) {
38
  function sta_npc_load() {
39
- if ( ! class_exists('STA_NPC_Plugin') ) {
40
  class STA_NPC_Plugin {
41
- var $admin_options_name = 'sta_npc_admin_options_name';
42
- var $admin_users_name = 'sta_npc_admin_options_name';
43
- var $plugin_domain = 'sta_npc_lang';
44
  public $plugin_name = 'no-page-comment';
45
  public $plugin_file;
46
  public $plugin_dir;
47
-
48
- // tansfer version 0.1.options to 0.2
49
- public function sta_npc_activate( ) {
50
- $sta_npc_options_retrieve = get_option($this->admin_options_name);
51
- if ( isset($sta_npc_options_retrieve['disable_comments']) ) {
52
- $sta_npc_options_retrieve['disable_comments_page'] = $sta_npc_options_retrieve['disable_comments'];
53
- unset($sta_npc_options_retrieve['disable_comments']);
54
- }
55
- if ( isset($sta_npc_options_retrieve['disable_trackbacks']) ) {
56
- $sta_npc_options_retrieve['disable_trackbacks_page'] = $sta_npc_options_retrieve['disable_trackbacks'];
57
- unset($sta_npc_options_retrieve['disable_trackbacks']);
58
- }
59
- update_option($this->admin_options_name, $sta_npc_options_retrieve);
60
- }
61
 
62
  // Plugin Constructor
63
  function sta_npc_plugin() {
64
- $this->plugin_dir = WP_PLUGIN_URL.'/'.$this->plugin_name;
65
  $this->plugin_file = $this->plugin_name . '.php';
66
  }
67
 
@@ -77,168 +84,131 @@ if ( ! function_exists('sta_npc_load') ) {
77
  'disable_comments_post' => '',
78
  'disable_trackbacks_post' => '',
79
  'disable_comments_page' => 'true',
80
- 'disable_trackbacks_page' => 'true'
 
 
81
  );
82
 
83
- foreach ( get_post_types('','objects') as $posttype ) {
84
- if ( in_array( $posttype->name, array('post','page','revision','nav_menu_item','attachment') ) )
85
  continue;
86
 
87
  $sta_npc_admin_options['disable_comments_' . $posttype->name] = 'true';
88
  $sta_npc_admin_options['disable_trackbacks_' . $posttype->name] = 'true';
89
-
90
  } // end foreach post types
91
 
92
  $sta_npc_options = get_option($this->admin_options_name);
93
- if ( ! empty($sta_npc_options) ) {
94
 
95
- foreach ($sta_npc_options as $key => $option)
96
  $sta_npc_admin_options[$key] = $option;
97
  }
98
- update_option($this->admin_options_name, $sta_npc_admin_options);
99
  return $sta_npc_admin_options;
100
  }
101
 
102
- // Prints out the admin page
103
  function sta_npc_print_admin_page() {
104
- $sta_npc_nonce = wp_create_nonce('sta_npc_nonce');
105
- $sta_npc_options = $this->sta_npc_get_admin_options();
106
 
107
- if ( isset($_POST['update_sta_npc_plugin_settings']) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
108
 
109
- foreach ( get_post_types('','objects') as $posttype ) {
110
- if ( in_array( $posttype->name, array('revision','nav_menu_item','attachment') ) )
111
- continue;
 
 
 
112
 
113
- if ( isset($_POST['sta_npc_disable_comments_' . $posttype->name]) ) {
114
- $sta_npc_options['disable_comments_' . $posttype->name] = $_POST['sta_npc_disable_comments_' . $posttype->name];
115
- } else {
116
- $sta_npc_options['disable_comments_' . $posttype->name] = 'false';
117
- }
118
 
119
- if ( isset($_POST['sta_npc_disable_trackbacks_' . $posttype->name]) ) {
120
- $sta_npc_options['disable_trackbacks_' . $posttype->name] = $_POST['sta_npc_disable_trackbacks_' . $posttype->name];
121
- } else {
122
- $sta_npc_options['disable_trackbacks_' . $posttype->name] = 'false';
123
- }
 
 
 
 
 
 
 
 
 
 
 
124
 
125
- } // end foreach post types
126
-
127
- update_option($this->admin_options_name, $sta_npc_options);
128
- ?>
129
- <div class="updated"><p><strong><?php _e('Settings Updated.', $this->plugin_domain);?></strong></p></div>
130
- <?php } ?>
131
-
132
- <div class="wrap">
133
- <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
134
- <div id="icon-options-general" class="icon32"><br></div>
135
- <h2>No Page Comment Settings</h2>
136
- <div id="poststuff" class="metabox-holder has-right-sidebar">
137
- <div id="side-info-column" class="inner-sidebar">
138
- <div id="side-sortables" class="meta-box-sortables ui-sortable">
139
- <div id="pageparentdiv" class="postbox">
140
- <h3 class="hndle" style="cursor:default;"><span>Other plugins by <a href="http://sethalling.com/" title="Seth Alling" style="font-size:15px;">Seth Alling</a>:</span></h3>
141
- <div class="inside">
142
- <ul>
143
- <li style="padding:5px 0;"><a href="http://sethalling.com/plugins/wordpress/wp-faqs-pro" title="WP FAQs Pro">WP FAQs Pro</a></li>
144
- </ul>
145
- </div>
146
- </div>
147
- <div id="pageparentdiv" class="postbox">
148
- <h3 class="hndle" style="cursor:default;"><span>Support No Page Comment</span></h3>
149
- <div class="inside">
150
- <ul>
151
- <li style="padding:5px 0;"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5WWP2EDSCAJR4" title="Donate to support the No Page Comment plugin development">Donate</a></li>
152
- <li style="padding:5px 0;"><a href="http://wordpress.org/support/view/plugin-reviews/no-page-comment#postform" title="Write a Review about No Page Comment">Write a Review</a></li>
153
- </ul>
154
- </div>
155
- </div>
156
- </div>
157
- </div>
158
- <div id="post-body">
159
- <div id="post-body-content">
160
- <div id="postcustom" class="postbox" style="">
161
- <h3 class="hndle" style="cursor:default;"><span>Disable comments on new:</span></h3>
162
- <div class="inside">
163
- <?php foreach ( get_post_types('','objects') as $posttype ) {
164
- if ( in_array( $posttype->name, array('revision','nav_menu_item','attachment') ) )
165
- continue; ?>
166
- <p style="padding:5px 0;">
167
- <strong class="post_type" style="width:160px; float:left;"><?php echo $posttype->label; ?></strong>
168
- <label for="sta_npc_disable_comments_<?php echo $posttype->name; ?>" style="width:110px; float:left;">
169
- <input type="checkbox" id="sta_npc_disable_comments_<?php echo $posttype->name; ?>" name="sta_npc_disable_comments_<?php echo $posttype->name; ?>" value="true" <?php if ( $sta_npc_options['disable_comments_' . $posttype->name] == 'true' ) { _e('checked="checked"', $this->plugin_domain); } ?> />
170
- Comments</label>
171
- <label for="sta_npc_disable_trackbacks_<?php echo $posttype->name; ?>" style="width:110px; float:left;">
172
- <input type="checkbox" id="sta_npc_disable_trackbacks_<?php echo $posttype->name; ?>" name="sta_npc_disable_trackbacks_<?php echo $posttype->name; ?>" value="true" <?php if ( $sta_npc_options['disable_trackbacks_' . $posttype->name] == 'true' ) { _e('checked="checked"', $this->plugin_domain); } ?>/> Trackbacks</label>
173
- </p>
174
- <br style="clear:both;" />
175
- <?php } ?>
176
- </div>
177
- </div>
178
- <p class="submit">
179
- <input type="submit" name="update_sta_npc_plugin_settings" id="submit" class="button-primary" value="<?php _e('Update Settings', $this->plugin_domain); ?>">
180
- </p>
181
- </div>
182
- <div id="post-body-content">
183
- <div id="postcustom" class="postbox" style="">
184
- <h3 class="hndle" style="cursor:default;"><span><?php _e('Modify all current:', $this->plugin_domain); ?></span></h3>
185
- <div class="inside">
186
- <?php foreach ( get_post_types('','objects') as $posttype ) {
187
- if ( in_array( $posttype->name, array('revision','nav_menu_item','attachment') ) )
188
- continue; ?>
189
- <p class="submit" style="padding:5px 0;">
190
- <strong class="post_type" style="width:160px; float:left;"><?php echo $posttype->label; ?></strong>
191
- <span style="float:left; margin-right:10px;">
192
- <input type="submit" name="disable_all_<?php echo $posttype->name; ?>_comments" class="button-primary sta_ajax_modify" data-nonce="<?php echo $sta_npc_nonce; ?>" data-post_type="<?php echo $posttype->name; ?>" data-post_label="<?php echo $posttype->label; ?>" data-comment_status="open" data-comment_type="comment" value="<?php _e('Disable All Comments', $this->plugin_domain); ?>" style="margin-bottom:5px; float:left;">
193
- <input type="submit" name="disable_all_<?php echo $posttype->name; ?>_trackbacks" class="button-primary sta_ajax_modify" data-nonce="<?php echo $sta_npc_nonce; ?>" data-post_type="<?php echo $posttype->name; ?>" data-post_label="<?php echo $posttype->label; ?>" data-comment_status="open" data-comment_type="ping" value="<?php _e('Disable All Trackbacks', $this->plugin_domain); ?>" style="clear:both; margin-bottom:5px; float:left;">
194
- </span>
195
- <span style="float:left;">
196
- <input type="submit" name="enable_all_<?php echo $posttype->name; ?>_comments" class="button-primary sta_ajax_modify" data-nonce="<?php echo $sta_npc_nonce; ?>" data-post_type="<?php echo $posttype->name; ?>" data-post_label="<?php echo $posttype->label; ?>" data-comment_status="closed" data-comment_type="comment" value="<?php _e('Enable All Comments', $this->plugin_domain); ?>" style="margin-bottom:5px; float:left;">
197
- <input type="submit" name="enable_all_<?php echo $posttype->name; ?>_trackbacks" class="button-primary sta_ajax_modify" data-nonce="<?php echo $sta_npc_nonce; ?>" data-post_type="<?php echo $posttype->name; ?>" data-post_label="<?php echo $posttype->label; ?>" data-comment_status="closed" data-comment_type="ping" value="<?php _e('Enable All Trackbacks', $this->plugin_domain); ?>" style="clear:both; float:left;">
198
- </span>
199
- </p>
200
- <br style="clear:both;" />
201
- <?php } ?>
202
- </div>
203
- </div>
204
- </div>
205
- </div>
206
- </div>
207
- </form>
208
- </div>
209
-
210
-
211
- <?php } // End sta_npc_print_admin_page function
212
-
213
- function sta_npc_settings_link($links, $file) {
214
- if ( basename($file) == $this->plugin_file ) {
215
- $settings_link = '<a href="' . admin_url('options-general.php?page=' . $this->plugin_file) . '">Settings</a>';
216
- array_unshift($links, $settings_link);
217
  }
218
- return $links;
219
  }
220
 
221
- function sta_npc_plugin_admin() {
222
- if ( function_exists('add_options_page') ) {
223
- add_options_page('No Page Comment Settings', 'No Page Comment', 'manage_options', $this->plugin_file, array( $this, 'sta_npc_print_admin_page' ));
 
 
 
 
 
 
 
 
 
 
224
  }
225
  }
226
 
227
- function sta_no_page_comment() {
 
228
  global $pagenow;
229
  global $post;
 
230
  $sta_npc_options = $this->sta_npc_get_admin_options();
231
- if ( (is_admin()) && ($pagenow=='post-new.php') && ($post->filter=='raw') ) {
232
- wp_enqueue_script('jquery');
233
  $posttype = $post->post_type; ?>
234
 
235
  <script type="text/javascript">
236
- jQuery(document).ready(function() {
237
  <?php if ( isset($sta_npc_options['disable_comments_' . $posttype]) ) {
238
  if ( $sta_npc_options['disable_comments_' . $posttype] == 'true' ) { ?>
239
  if ( jQuery('#comment_status').length ) {
240
  jQuery('#comment_status').attr('checked', false);
241
  }
 
 
 
 
242
  <?php }
243
  }
244
  if ( isset($sta_npc_options['disable_trackbacks_' . $posttype]) ) {
@@ -246,26 +216,39 @@ if ( ! function_exists('sta_npc_load') ) {
246
  if ( jQuery('#ping_status').length ) {
247
  jQuery('#ping_status').attr('checked', false);
248
  }
 
 
 
 
249
  <?php }
250
  } ?>
251
  });
252
  </script>
253
 
254
- <?php } elseif ( (is_admin()) && ($pagenow=='options-general.php') && isset($_GET['page']) && ( $_GET['page'] == 'no-page-comment.php' ) ) {
255
- wp_enqueue_script('jquery');
256
- // Load Ajax File
257
- wp_register_script( 'ajax-script', plugins_url('/page-comment.js',__FILE__), array('jquery') );
258
- wp_localize_script( 'ajax-script', 'myAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
259
 
260
- wp_enqueue_script( 'jquery' );
261
- wp_enqueue_script( 'ajax-script' );
 
 
 
 
 
 
 
 
 
 
 
 
262
  }
263
  }
264
 
265
  // Ajax Function for WP Comment DB Modification
266
  function sta_npc_mod() {
267
- if ( !wp_verify_nonce( $_REQUEST['nonce'], 'sta_npc_nonce')) {
268
- exit('No naughty business please');
269
  }
270
 
271
  global $wpdb;
@@ -273,16 +256,16 @@ if ( ! function_exists('sta_npc_load') ) {
273
  $result[] = array();
274
  $comment_type = $_REQUEST['comment_type'];
275
  $comment_status = $_REQUEST['comment_status'];
276
- if ($comment_status == 'open')
277
  $comment_new_status = 'closed';
278
- elseif ($comment_status == 'closed') {
279
  $comment_new_status = 'open';
280
  }
281
- $post_type = $_REQUEST['post_type'];
282
- $post_label = $_REQUEST['post_label'];
283
 
284
 
285
- if ($comment_type == 'ping') {
286
  $comment_label = 'trackbacks';
287
  $comment_query = $wpdb->prepare(
288
  "
@@ -310,21 +293,21 @@ if ( ! function_exists('sta_npc_load') ) {
310
  );
311
  }
312
 
313
- if( $comment_query === FALSE ) {
314
  $result['type'] = 'error';
315
  $result['message'] = 'Something went wrong. Please refresh this page and try again.';
316
  } else {
317
- $wpdb->query($comment_query);
318
  $result['type'] = 'success';
319
  $result['message'] = 'All ' . $comment_label . ' of ' . $post_label . ' have been marked as ' . $comment_new_status;
320
  }
321
 
322
- if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
323
- $result = json_encode($result);
324
  echo $result;
325
  }
326
  else {
327
- header('Location: '.$_SERVER['HTTP_REFERER']);
328
  }
329
 
330
  die();
@@ -332,29 +315,80 @@ if ( ! function_exists('sta_npc_load') ) {
332
  }
333
 
334
  function nopriv_sta_npc_mod() {
335
- exit('No naughty business please');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  }
337
 
338
  }
339
 
340
  } // End Class STA_NPC_Plugin
341
 
342
- if ( class_exists('STA_NPC_Plugin') ) {
343
  global $sta_npc_plugin;
344
  $sta_npc_plugin = new STA_NPC_Plugin();
345
  }
346
 
347
  // Actions, Filters and Shortcodes
348
- if ( isset($sta_npc_plugin) ) {
349
  // Actions
350
- add_action('admin_menu', array( &$sta_npc_plugin, 'sta_npc_plugin_admin' )); // Activate admin settings page
351
- add_action('activate_no-page-comment/no-page-comment.php', array( &$sta_npc_plugin, 'sta_npc_init' )); // Activate admin options
352
- add_action( 'admin_head', array( &$sta_npc_plugin, 'sta_no_page_comment' )); // Add ajax scripts
353
- add_action('wp_ajax_sta_npc_mod', array( &$sta_npc_plugin, 'sta_npc_mod')); // Add ajax function
354
- add_action('wp_ajax_nopriv_sta_npc_mod', array( &$sta_npc_plugin, 'nopriv_sta_npc_mod')); // Add logged out ajax function
 
 
355
 
356
  // Filters
357
- add_filter('plugin_action_links', array( &$sta_npc_plugin, 'sta_npc_settings_link'), 10, 2 );
 
 
 
 
 
 
 
 
 
 
358
  }
359
  }
360
  }
3
  Plugin Name: No Page Comment
4
  Plugin URI: http://sethalling.com/plugins/no-page-comment
5
  Description: A plugin that uses javascript to disable comments by default on posts, pages and/or custom post types but leave them enabled on others, while still giving you the ability to individually set them on a page or post basis.
6
+ Version: 1.0.1
7
  Author: Seth Alling
8
  Author URI: http://sethalling.com/
9
 
10
+ Plugin: Copyright (c) 2011-2014 Seth Alling
11
 
12
  This program is free software; you can redistribute it and/or
13
  modify it under the terms of the GNU General Public License
22
  You should have received a copy of the GNU General Public License
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
+ _____ _ _ _ _ _ _...._
26
+ / ____| | | | | /\ | | (_) .'/ \ _'.
27
+ | (___ ___| |_| |__ / \ | | |_ _ __ __ _ /##\__/##\_\
28
+ \___ \ / _ \ __| '_ \ / /\ \ | | | | '_ \ / _` | |\##/ \##/ |
29
+ ____) | __/ |_| | | | / ____ \| | | | | | | (_| | |/ \__/ \ _|
30
+ |_____/ \___|\__|_| |_| /_/ \_\_|_|_|_| |_|\__, | \ _/##\__/#/
31
+ __/ | '.\##/__.'
32
+ Plugin developed by: http://sethalling.com |___/ `""""`
33
  */
34
 
35
+ register_activation_hook( __FILE__, 'sta_npc_activate' );
36
 
37
+ define( 'STA_NPC_WP_VERSION', version_compare( get_bloginfo( 'version' ), '3.4', '>=' ) );
38
+
39
+ if ( ! function_exists( 'sta_npc_activate' ) ) {
40
  function sta_npc_activate() {
41
  sta_npc_load();
42
  global $sta_npc_plugin;
 
43
  }
44
  }
45
 
46
+ if ( ! function_exists( 'sta_npc_load' ) ) {
47
  function sta_npc_load() {
48
+ if ( ! class_exists( 'STA_NPC_Plugin' ) ) {
49
  class STA_NPC_Plugin {
50
+ var $admin_options_name = 'sta_npc_admin_options_name',
51
+ $admin_users_name = 'sta_npc_admin_options_name',
52
+ $plugin_domain = 'sta_npc_lang';
53
  public $plugin_name = 'no-page-comment';
54
  public $plugin_file;
55
  public $plugin_dir;
56
+ public $wp_posttypes = array(
57
+ 'post',
58
+ 'page',
59
+ 'revision',
60
+ 'nav_menu_item',
61
+ 'attachment'
62
+ );
63
+ public $excluded_posttypes = array(
64
+ 'revision',
65
+ 'nav_menu_item',
66
+ );
67
+ public $plugin_ver = '1.0.1';
 
 
68
 
69
  // Plugin Constructor
70
  function sta_npc_plugin() {
71
+ $this->plugin_dir = WP_PLUGIN_URL . '/' . $this->plugin_name;
72
  $this->plugin_file = $this->plugin_name . '.php';
73
  }
74
 
84
  'disable_comments_post' => '',
85
  'disable_trackbacks_post' => '',
86
  'disable_comments_page' => 'true',
87
+ 'disable_trackbacks_page' => 'true',
88
+ 'disable_comments_attachment' => '',
89
+ 'disable_trackbacks_attachment' => ''
90
  );
91
 
92
+ foreach ( get_post_types( '', 'objects' ) as $posttype ) {
93
+ if ( in_array( $posttype->name, $this->wp_posttypes ) )
94
  continue;
95
 
96
  $sta_npc_admin_options['disable_comments_' . $posttype->name] = 'true';
97
  $sta_npc_admin_options['disable_trackbacks_' . $posttype->name] = 'true';
 
98
  } // end foreach post types
99
 
100
  $sta_npc_options = get_option($this->admin_options_name);
101
+ if ( ! empty( $sta_npc_options ) ) {
102
 
103
+ foreach ( $sta_npc_options as $key => $option )
104
  $sta_npc_admin_options[$key] = $option;
105
  }
106
+ update_option( $this->admin_options_name, $sta_npc_admin_options );
107
  return $sta_npc_admin_options;
108
  }
109
 
110
+ // Print out the admin page
111
  function sta_npc_print_admin_page() {
112
+ include( dirname( __FILE__ ) . '/no-page-comment-settings.php' );
113
+ }
114
 
115
+ // Add stylesheet to admin page
116
+ function sta_npc_admin_styles() {
117
+ wp_register_style( 'sta_npc', $this->plugin_dir . '/no-page-comment.css', false, $this->plugin_ver );
118
+ wp_enqueue_style( 'sta_npc' );
119
+ }
120
+
121
+ // Add settings link to plugins page
122
+ function sta_npc_settings_link( $links, $file ) {
123
+ if ( basename( $file ) == $this->plugin_file ) {
124
+ $settings_link = '<a href="' . admin_url( 'options-general.php?page=' . $this->plugin_file ) . '">' . __( 'Settings', $this->plugin_domain ) . '</a>';
125
+ array_unshift( $links, $settings_link );
126
+ }
127
+ return $links;
128
+ }
129
 
130
+ // Add settings page to options sidebar
131
+ function sta_npc_plugin_admin() {
132
+ if ( function_exists( 'add_options_page' ) ) {
133
+ add_options_page( 'No Page Comment Settings', 'No Page Comment', 'manage_options', $this->plugin_file, array( $this, 'sta_npc_print_admin_page' ) );
134
+ }
135
+ }
136
 
137
+ // Modify discussion options page with a link to NPC settings page
138
+ function sta_discussion_options() {
139
+ global $pagenow;
140
+ global $post;
 
141
 
142
+ if ( ( is_admin() ) && ( $pagenow == 'options-discussion.php' ) ) {
143
+ $settings_link = __( 'Comment and trackback defaults controlled through', $this->plugin_domain ) . ' <a href="' . admin_url( 'options-general.php?page=' . $this->plugin_file ) . '">' . __( 'No Page Comment Settings', $this->plugin_domain ) . '</a>';
144
+ wp_enqueue_script( 'jquery' ); ?>
145
+
146
+ <script type="text/javascript">
147
+ jQuery(document).ready( function() {
148
+ jQuery('label[for="default_ping_status"]').remove().prev('br').remove();
149
+ jQuery('label[for="default_comment_status"]').prev('br').remove();
150
+ jQuery('label[for="default_comment_status"]').next('br').remove();
151
+ jQuery('label[for="default_comment_status"]').next('p').html('<?php echo $settings_link; ?>');
152
+ jQuery('label[for="default_comment_status"]').remove();
153
+ });
154
+ </script>
155
+
156
+ <?php }
157
+ }
158
 
159
+ // Disable comments with hook
160
+ function sta_no_page_comment() {
161
+ global $pagenow;
162
+ $sta_npc_options = $this->sta_npc_get_admin_options();
163
+ if ( ( is_admin() ) && ( $pagenow == 'post-new.php' ) ) {
164
+ wp_enqueue_script( 'jquery' );
165
+ $posttype = ( isset( $_GET['post_type'] ) ) ? $_GET['post_type'] : 'post';
166
+
167
+ if ( $sta_npc_options['disable_comments_' . $posttype] == 'true' ) {
168
+ return 'closed';
169
+ } else {
170
+ return 'open';
171
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  }
 
173
  }
174
 
175
+ // Disable trackbacks with hook
176
+ function sta_no_page_trackback() {
177
+ global $pagenow;
178
+ $sta_npc_options = $this->sta_npc_get_admin_options();
179
+ if ( ( is_admin() ) && ( $pagenow == 'post-new.php' ) ) {
180
+ wp_enqueue_script( 'jquery' );
181
+ $posttype = ( isset( $_GET['post_type'] ) ) ? $_GET['post_type'] : 'post';
182
+
183
+ if ( $sta_npc_options['disable_trackbacks_' . $posttype] == 'true' ) {
184
+ return 'closed';
185
+ } else {
186
+ return 'open';
187
+ }
188
  }
189
  }
190
 
191
+ // Disable comments/trackbacks with jQuery (for WP versions earlier than 3.4)
192
+ function sta_no_page_comment_jquery() {
193
  global $pagenow;
194
  global $post;
195
+
196
  $sta_npc_options = $this->sta_npc_get_admin_options();
197
+ if ( ( is_admin() ) && ( $pagenow == 'post-new.php' ) && ( $post->filter == 'raw' ) ) {
198
+ wp_enqueue_script( 'jquery' );
199
  $posttype = $post->post_type; ?>
200
 
201
  <script type="text/javascript">
202
+ jQuery(document).ready( function() {
203
  <?php if ( isset($sta_npc_options['disable_comments_' . $posttype]) ) {
204
  if ( $sta_npc_options['disable_comments_' . $posttype] == 'true' ) { ?>
205
  if ( jQuery('#comment_status').length ) {
206
  jQuery('#comment_status').attr('checked', false);
207
  }
208
+ <?php } else { ?>
209
+ if ( jQuery('#comment_status').length ) {
210
+ jQuery('#comment_status').attr('checked', true);
211
+ }
212
  <?php }
213
  }
214
  if ( isset($sta_npc_options['disable_trackbacks_' . $posttype]) ) {
216
  if ( jQuery('#ping_status').length ) {
217
  jQuery('#ping_status').attr('checked', false);
218
  }
219
+ <?php } else { ?>
220
+ if ( jQuery('#ping_status').length ) {
221
+ jQuery('#ping_status').attr('checked', true);
222
+ }
223
  <?php }
224
  } ?>
225
  });
226
  </script>
227
 
228
+ <?php }
229
+ }
 
 
 
230
 
231
+ // Add ajax script to admin page
232
+ function sta_no_page_comment_ajax() {
233
+ global $pagenow;
234
+ global $post;
235
+ if ( ( is_admin() ) && ( $pagenow == 'options-general.php' ) && isset( $_GET['page'] ) ) {
236
+ if ( $_GET['page'] == 'no-page-comment.php' ) {
237
+ wp_enqueue_script( 'jquery' );
238
+ // Load Ajax File
239
+ wp_register_script( 'ajax-script', plugins_url( '/page-comment.js', __FILE__ ), array( 'jquery' ) );
240
+ wp_localize_script( 'ajax-script', 'myAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
241
+
242
+ wp_enqueue_script( 'jquery' );
243
+ wp_enqueue_script( 'ajax-script' );
244
+ }
245
  }
246
  }
247
 
248
  // Ajax Function for WP Comment DB Modification
249
  function sta_npc_mod() {
250
+ if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'sta_npc_nonce') ) {
251
+ exit( 'No naughty business please' );
252
  }
253
 
254
  global $wpdb;
256
  $result[] = array();
257
  $comment_type = $_REQUEST['comment_type'];
258
  $comment_status = $_REQUEST['comment_status'];
259
+ if ( $comment_status == 'open' )
260
  $comment_new_status = 'closed';
261
+ elseif ( $comment_status == 'closed' ) {
262
  $comment_new_status = 'open';
263
  }
264
+ $post_type = $_REQUEST['post_type'];
265
+ $post_label = $_REQUEST['post_label'];
266
 
267
 
268
+ if ( $comment_type == 'ping' ) {
269
  $comment_label = 'trackbacks';
270
  $comment_query = $wpdb->prepare(
271
  "
293
  );
294
  }
295
 
296
+ if ( $comment_query === FALSE ) {
297
  $result['type'] = 'error';
298
  $result['message'] = 'Something went wrong. Please refresh this page and try again.';
299
  } else {
300
+ $wpdb->query( $comment_query );
301
  $result['type'] = 'success';
302
  $result['message'] = 'All ' . $comment_label . ' of ' . $post_label . ' have been marked as ' . $comment_new_status;
303
  }
304
 
305
+ if ( ! empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) {
306
+ $result = json_encode( $result );
307
  echo $result;
308
  }
309
  else {
310
+ header( 'Location: ' . $_SERVER['HTTP_REFERER'] );
311
  }
312
 
313
  die();
315
  }
316
 
317
  function nopriv_sta_npc_mod() {
318
+ exit( 'No naughty business please' );
319
+ }
320
+
321
+ // Disable comments/trackbacks on attachments
322
+ function attachment_comment( $id ) {
323
+ global $wpdb;
324
+ $sta_npc_options = $this->sta_npc_get_admin_options();
325
+ $comment_status = ( $sta_npc_options['disable_comments_attachment'] == 'true' ) ? 'closed' : 'open';
326
+ $trackback_status = ( $sta_npc_options['disable_trackbacks_attachment'] == 'true' ) ? 'closed' : 'open';
327
+
328
+ $comment_query = $wpdb->prepare(
329
+ "
330
+ UPDATE $wpdb->posts
331
+ SET comment_status = %s
332
+ WHERE ID = %s
333
+ ",
334
+ $comment_status,
335
+ $id
336
+ );
337
+
338
+ $trackback_query = $wpdb->prepare(
339
+ "
340
+ UPDATE $wpdb->posts
341
+ SET ping_status = %s
342
+ WHERE ID = %s
343
+ ",
344
+ $trackback_status,
345
+ $id
346
+ );
347
+
348
+ if ( $comment_query === FALSE ) {
349
+ } else {
350
+ $wpdb->query( $comment_query );
351
+ }
352
+
353
+ if ( $trackback_query === FALSE ) {
354
+ } else {
355
+ $wpdb->query( $trackback_query );
356
+ }
357
+
358
  }
359
 
360
  }
361
 
362
  } // End Class STA_NPC_Plugin
363
 
364
+ if ( class_exists( 'STA_NPC_Plugin' ) ) {
365
  global $sta_npc_plugin;
366
  $sta_npc_plugin = new STA_NPC_Plugin();
367
  }
368
 
369
  // Actions, Filters and Shortcodes
370
+ if ( isset( $sta_npc_plugin ) ) {
371
  // Actions
372
+ add_action( 'admin_menu', array( &$sta_npc_plugin, 'sta_npc_plugin_admin' ) ); // Activate admin settings page
373
+ add_action( 'activate_no-page-comment/no-page-comment.php', array( &$sta_npc_plugin, 'sta_npc_init' ) ); // Activate admin options
374
+ add_action( 'admin_enqueue_scripts', array( &$sta_npc_plugin, 'sta_npc_admin_styles' ) ); // Add admin stylesheet
375
+ add_action( 'admin_head', array( &$sta_npc_plugin, 'sta_no_page_comment_ajax' ) ); // Add ajax scripts
376
+ add_action( 'wp_ajax_sta_npc_mod', array( &$sta_npc_plugin, 'sta_npc_mod' ) ); // Add ajax function
377
+ add_action( 'wp_ajax_nopriv_sta_npc_mod', array( &$sta_npc_plugin, 'nopriv_sta_npc_mod' ) ); // Add logged out ajax function
378
+ add_action( 'add_attachment', array( &$sta_npc_plugin, 'attachment_comment' ) ); // Set comment status on new attachments
379
 
380
  // Filters
381
+ add_filter( 'plugin_action_links', array( &$sta_npc_plugin, 'sta_npc_settings_link' ), 10, 2 ); // Add settings link to plugins page
382
+ add_filter( 'admin_head', array(&$sta_npc_plugin, 'sta_discussion_options' ) ); // Change discussion options replace defaults with link to NPC settings
383
+
384
+ // Use jQuery for WordPress versions earlier than 3.4
385
+ if ( STA_NPC_WP_VERSION ) {
386
+ add_filter( 'pre_option_default_comment_status', array(&$sta_npc_plugin, 'sta_no_page_comment' ) ); // Comment settings
387
+ add_filter( 'pre_option_default_ping_status', array(&$sta_npc_plugin, 'sta_no_page_trackback' ) ); // Trackback settings
388
+ } else {
389
+ add_action( 'admin_head', array( &$sta_npc_plugin, 'sta_no_page_comment_jquery' ) ); // Add jquery scripts
390
+ }
391
+
392
  }
393
  }
394
  }
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
 
3
  Contributors: sethta
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5WWP2EDSCAJR4
5
- Tags: admin, comments, custom post type, javascript, page, pages, post, posts, plugin, settings, tools, trackbacks
6
  Requires at least: 3.1
7
- Tested up to: 3.5
8
  Stable tag: trunk
9
 
10
  Disable comments by default on new pages and custom post types, while still giving you the ability to individually set them on a page or post basis.
@@ -13,12 +13,16 @@ Disable comments by default on new pages and custom post types, while still givi
13
 
14
  By default, WordPress gives you two options. You can either disable comments and trackbacks by default for all pages and posts, or you can have them active by default. Unfortunately, there is no specific WordPress setting that allows comments and trackbacks to be active by default for posts, while disabling them on pages or any other post type.
15
 
16
- There have been workarounds created by disabling comments site-wide on all pages and/or posts, but what if you actually want to have comments on a page or two? The difference between this plugin and others is that it will automatically uncheck to discussion settings boxes for you when creating a new page, while still giving you the flexibility to open comments up specifically on individual pages and post types.
17
 
18
- Also, if you are looking for a quick way to disable all comments or pingbacks for a specific custom post type, that feature has now been built into the plugin. It directly interacts with your database to modify the status, so it is highly recommended that you backup your database first. There shouldn't be any issues with this feature, but it's always good to play it safe.
19
 
20
  [Official No Page Comment Plugin Page](http://sethalling.com/plugins/wordpress/no-page-comment "No Page Comment WordPress Plugin")
21
 
 
 
 
 
22
  [Donate to Support No Page Comment Development](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5WWP2EDSCAJR4 "Donate to support the No Page Comment Plugin development")
23
 
24
  == Installation ==
@@ -30,7 +34,7 @@ Also, if you are looking for a quick way to disable all comments or pingbacks fo
30
 
31
  = Settings Page =
32
 
33
- Click 'No Page Comment' in the settings panel. A screen will display showing the following settings for posts, pages, and any other custom post type installed on your blog:
34
 
35
  * Disable comments
36
  * Disable trackbacks
@@ -43,15 +47,17 @@ Also, there is now the option to globally enable/disable comments or pingbacks o
43
 
44
  = Why aren't comments and trackbacks being disabled? =
45
 
46
- Javascript probably isn't active on your browser. Enable javascript for the plugin to work correctly.
47
-
48
- = Why are comments disabled in posts as well? =
49
 
50
- This is most likely due to a setting in WordPress. Go to the 'Discussion' settings page and make sure that comments are enabled. This is required for the plugin to work properly.
51
 
52
  = Why can't I enable comments of custom post type: "X" =
53
 
54
- Depending on your theme or plugin that created custom post type "X", that post type may not have comments set up. If this is the case, this plugin cannot help you and you will have to talk to that theme/plugin author.
 
 
 
 
55
 
56
  = How do I modify the comment settings on an individual post or page? =
57
 
@@ -59,14 +65,30 @@ First, you must make sure you can see the Discussion admin box. Enable this by c
59
 
60
  = I want to quickly disable all trackbacks throughout my blog posts. Is this possible? =
61
 
62
- Of course, although *it is highly recommended that you backup your blog's database prior to completing this step*. Go to the 'No Page Comment' settings page and scroll to the bottom of the page. There is an area that will allow you to either enable or disble both comments and trackbacks for any post type you have installed on your blog.
 
 
 
 
63
 
64
  == Screenshots ==
65
 
66
- 1. The Settings page on a fresh WordPress 3.5 installation
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  = 0.3 =
71
  * NEW: Add ability to enable/disable all comments or trackbacks on any specific custom post type. It is highly recommended that you backup your blog's database prior to doing this.
72
 
@@ -80,6 +102,9 @@ Of course, although *it is highly recommended that you backup your blog's databa
80
 
81
  == Upgrade Notice ==
82
 
 
 
 
83
  = 0.3 =
84
  Adds the ability to enable/disable all comments or trackbacks on any specific custom post type. All previous No Page Comment settings will remain intact with upgrade.
85
 
2
 
3
  Contributors: sethta
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5WWP2EDSCAJR4
5
+ Tags: admin, comments, custom post type, page, pages, post, posts, attachment, attachments, media, plugin, settings, tools, trackbacks
6
  Requires at least: 3.1
7
+ Tested up to: 3.8
8
  Stable tag: trunk
9
 
10
  Disable comments by default on new pages and custom post types, while still giving you the ability to individually set them on a page or post basis.
13
 
14
  By default, WordPress gives you two options. You can either disable comments and trackbacks by default for all pages and posts, or you can have them active by default. Unfortunately, there is no specific WordPress setting that allows comments and trackbacks to be active by default for posts, while disabling them on pages or any other post type.
15
 
16
+ Workarounds exist by disabling comments site-wide on all pages and/or posts, but what if you actually want to have comments on a page or two? The difference between this plugin and others is that it will automatically uncheck to discussion settings boxes for you when creating a new page, while still giving you the flexibility to open comments up specifically on individual pages and post types.
17
 
18
+ Also, this plugin provides a way to quickly disable all comments or pingbacks for a specific custom post type. It directly interacts with your database to modify the status, so it is highly recommended that you backup your database first. There shouldn't be any issues using this feature, but it's always good to play it safe.
19
 
20
  [Official No Page Comment Plugin Page](http://sethalling.com/plugins/wordpress/no-page-comment "No Page Comment WordPress Plugin")
21
 
22
+ [View No Page Comment Development on Github](https://github.com/sethta/no-page-comment "No Page Comment Development on Github")
23
+
24
+ [Please Report any Issues about No Page Comment on Github](https://github.com/sethta/no-page-comment/issues "Report an Issue about No Page Comment on Github")
25
+
26
  [Donate to Support No Page Comment Development](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5WWP2EDSCAJR4 "Donate to support the No Page Comment Plugin development")
27
 
28
  == Installation ==
34
 
35
  = Settings Page =
36
 
37
+ Click 'No Page Comment' in the settings panel. A screen will display showing the following settings for posts, pages, attachments and any other custom post type installed on your blog:
38
 
39
  * Disable comments
40
  * Disable trackbacks
47
 
48
  = Why aren't comments and trackbacks being disabled? =
49
 
50
+ There are two possible issues for this. The first is that you are using a version of WordPress earlier than 3.4 and have javascript disabled as it relies on jQuery. WordPress version of 3.4 and later do not require javascript.
 
 
51
 
52
+ The second possible issue is that you are duplicating a post or page. This plugin only works when you are on a new post/page screen, while plugins that duplicate posts, duplicate the post first and then take you to an edit screen. Unfortunately, there is no way to get around this issue, so if you plan on using a duplication plugin, then you will just have to remember to disable your comments.
53
 
54
  = Why can't I enable comments of custom post type: "X" =
55
 
56
+ Depending on your theme or plugin that created custom post type "X", that post type may not have comments set up. If this is the case, this plugin cannot help you and you will have to talk to your theme/plugin author.
57
+
58
+ = Why is "Comments are closed" or some other text displayed after I disable my comments? =
59
+
60
+ Many themes will include text to show that comments are not enabled on a post. To remove it, you would need to talk to your theme author.
61
 
62
  = How do I modify the comment settings on an individual post or page? =
63
 
65
 
66
  = I want to quickly disable all trackbacks throughout my blog posts. Is this possible? =
67
 
68
+ Of course, although *it is highly recommended that you backup your blog's database prior to completing this step*. Go to the 'No Page Comment' settings page and scroll to the bottom of the page. There is an area that will allow you to either enable or disable both comments and trackbacks for any post type you have installed on your blog.
69
+
70
+ = How can I help support No Page Comment? =
71
+
72
+ [Donations](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5WWP2EDSCAJR4 "Donate to support the No Page Comment Plugin development") are always accepted, but I am also looking for help from others who want to make this plugin better. Please [fork the plugin on Github](https://github.com/sethta/no-page-comment "Fork No Page Comment on Github") and feel free to [report any issues](https://github.com/sethta/no-page-comment/issues "Report an Issue about No Page Comment on Github").
73
 
74
  == Screenshots ==
75
 
76
+ 1. The Settings page on a fresh WordPress 3.8 installation
77
 
78
  == Changelog ==
79
 
80
+ = 1.0.1 =
81
+ * FIX: Added missing files from failed SVN commit.
82
+
83
+ = 1.0 =
84
+ * UPDATE: Rewrite plugin to decrease code bloat
85
+ * UPDATE: Remove javascript dependency by default for WordPress versions 3.4 and up
86
+ * UPDATE: Fix settings so they are not dependent on WordPress's comment settings
87
+ * UPDATE: Fix settings page so it displays responsively
88
+ * NEW: Add support for attachments
89
+ * NEW: Update discussion options page to include link to No Page Comment settings page
90
+ * NEW: Prepare plugin for translation into other languages
91
+
92
  = 0.3 =
93
  * NEW: Add ability to enable/disable all comments or trackbacks on any specific custom post type. It is highly recommended that you backup your blog's database prior to doing this.
94
 
102
 
103
  == Upgrade Notice ==
104
 
105
+ = 1.0 =
106
+ Improves plugin performance and adds ability to enable/disable all comments or trackbacks on attachment pages. All previous No Page Comment settings will remain intact with upgrade.
107
+
108
  = 0.3 =
109
  Adds the ability to enable/disable all comments or trackbacks on any specific custom post type. All previous No Page Comment settings will remain intact with upgrade.
110