11 if ( ! current_user_can( 'manage_options' ) ) |
11 if ( ! current_user_can( 'manage_options' ) ) |
12 wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); |
12 wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); |
13 |
13 |
14 $title = __('Discussion Settings'); |
14 $title = __('Discussion Settings'); |
15 $parent_file = 'options-general.php'; |
15 $parent_file = 'options-general.php'; |
|
16 |
|
17 /** |
|
18 * Output JavaScript to toggle display of additional settings if avatars are disabled. |
|
19 * |
|
20 * @since 4.2.0 |
|
21 */ |
|
22 function options_discussion_add_js() { |
|
23 ?> |
|
24 <script> |
|
25 (function($){ |
|
26 var parent = $( '#show_avatars' ), |
|
27 children = $( '.avatar-settings' ); |
|
28 parent.change(function(){ |
|
29 children.toggleClass( 'hide-if-js', ! this.checked ); |
|
30 }); |
|
31 })(jQuery); |
|
32 </script> |
|
33 <?php |
|
34 } |
|
35 add_action( 'admin_print_footer_scripts', 'options_discussion_add_js' ); |
16 |
36 |
17 get_current_screen()->add_help_tab( array( |
37 get_current_screen()->add_help_tab( array( |
18 'id' => 'overview', |
38 'id' => 'overview', |
19 'title' => __('Overview'), |
39 'title' => __('Overview'), |
20 'content' => '<p>' . __('This screen provides many options for controlling the management and display of comments and links to your posts/pages. So many, in fact, they won’t all fit here! :) Use the documentation links to get information on what each discussion setting does.') . '</p>' . |
40 'content' => '<p>' . __('This screen provides many options for controlling the management and display of comments and links to your posts/pages. So many, in fact, they won’t all fit here! :) Use the documentation links to get information on what each discussion setting does.') . '</p>' . |
21 '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', |
41 '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', |
22 ) ); |
42 ) ); |
23 |
43 |
24 get_current_screen()->set_help_sidebar( |
44 get_current_screen()->set_help_sidebar( |
25 '<p><strong>' . __('For more information:') . '</strong></p>' . |
45 '<p><strong>' . __('For more information:') . '</strong></p>' . |
26 '<p>' . __('<a href="http://codex.wordpress.org/Settings_Discussion_Screen" target="_blank">Documentation on Discussion Settings</a>') . '</p>' . |
46 '<p>' . __('<a href="https://codex.wordpress.org/Settings_Discussion_Screen" target="_blank">Documentation on Discussion Settings</a>') . '</p>' . |
27 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
47 '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
28 ); |
48 ); |
29 |
49 |
30 include( ABSPATH . 'wp-admin/admin-header.php' ); |
50 include( ABSPATH . 'wp-admin/admin-header.php' ); |
31 ?> |
51 ?> |
32 |
52 |
33 <div class="wrap"> |
53 <div class="wrap"> |
34 <?php screen_icon(); ?> |
|
35 <h2><?php echo esc_html( $title ); ?></h2> |
54 <h2><?php echo esc_html( $title ); ?></h2> |
36 |
55 |
37 <form method="post" action="options.php"> |
56 <form method="post" action="options.php"> |
38 <?php settings_fields('discussion'); ?> |
57 <?php settings_fields('discussion'); ?> |
39 |
58 |
40 <table class="form-table"> |
59 <table class="form-table"> |
41 <tr valign="top"> |
60 <tr> |
42 <th scope="row"><?php _e('Default article settings'); ?></th> |
61 <th scope="row"><?php _e('Default article settings'); ?></th> |
43 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Default article settings'); ?></span></legend> |
62 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Default article settings'); ?></span></legend> |
44 <label for="default_pingback_flag"> |
63 <label for="default_pingback_flag"> |
45 <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> /> |
64 <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> /> |
46 <?php _e('Attempt to notify any blogs linked to from the article'); ?></label> |
65 <?php _e('Attempt to notify any blogs linked to from the article'); ?></label> |
51 <br /> |
70 <br /> |
52 <label for="default_comment_status"> |
71 <label for="default_comment_status"> |
53 <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> /> |
72 <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> /> |
54 <?php _e('Allow people to post comments on new articles'); ?></label> |
73 <?php _e('Allow people to post comments on new articles'); ?></label> |
55 <br /> |
74 <br /> |
56 <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small> |
75 <p class="description"><?php echo '(' . __( 'These settings may be overridden for individual articles.' ) . ')'; ?></p> |
57 </fieldset></td> |
76 </fieldset></td> |
58 </tr> |
77 </tr> |
59 <tr valign="top"> |
78 <tr> |
60 <th scope="row"><?php _e('Other comment settings'); ?></th> |
79 <th scope="row"><?php _e('Other comment settings'); ?></th> |
61 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Other comment settings'); ?></span></legend> |
80 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Other comment settings'); ?></span></legend> |
62 <label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail'); ?></label> |
81 <label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail'); ?></label> |
63 <br /> |
82 <br /> |
64 <label for="comment_registration"> |
83 <label for="comment_registration"> |
122 printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order ); |
141 printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order ); |
123 |
142 |
124 ?></label> |
143 ?></label> |
125 </fieldset></td> |
144 </fieldset></td> |
126 </tr> |
145 </tr> |
127 <tr valign="top"> |
146 <tr> |
128 <th scope="row"><?php _e('E-mail me whenever'); ?></th> |
147 <th scope="row"><?php _e('E-mail me whenever'); ?></th> |
129 <td><fieldset><legend class="screen-reader-text"><span><?php _e('E-mail me whenever'); ?></span></legend> |
148 <td><fieldset><legend class="screen-reader-text"><span><?php _e('E-mail me whenever'); ?></span></legend> |
130 <label for="comments_notify"> |
149 <label for="comments_notify"> |
131 <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> /> |
150 <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> /> |
132 <?php _e('Anyone posts a comment'); ?> </label> |
151 <?php _e('Anyone posts a comment'); ?> </label> |
134 <label for="moderation_notify"> |
153 <label for="moderation_notify"> |
135 <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> /> |
154 <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> /> |
136 <?php _e('A comment is held for moderation'); ?> </label> |
155 <?php _e('A comment is held for moderation'); ?> </label> |
137 </fieldset></td> |
156 </fieldset></td> |
138 </tr> |
157 </tr> |
139 <tr valign="top"> |
158 <tr> |
140 <th scope="row"><?php _e('Before a comment appears'); ?></th> |
159 <th scope="row"><?php _e('Before a comment appears'); ?></th> |
141 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Before a comment appears'); ?></span></legend> |
160 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Before a comment appears'); ?></span></legend> |
142 <label for="comment_moderation"> |
161 <label for="comment_moderation"> |
143 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> /> |
162 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> /> |
144 <?php _e('Comment must be manually approved'); ?> </label> |
163 <?php _e('Comment must be manually approved'); ?> </label> |
145 <br /> |
164 <br /> |
146 <label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment'); ?></label> |
165 <label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment'); ?></label> |
147 </fieldset></td> |
166 </fieldset></td> |
148 </tr> |
167 </tr> |
149 <tr valign="top"> |
168 <tr> |
150 <th scope="row"><?php _e('Comment Moderation'); ?></th> |
169 <th scope="row"><?php _e('Comment Moderation'); ?></th> |
151 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Moderation'); ?></span></legend> |
170 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Moderation'); ?></span></legend> |
152 <p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="number" step="1" min="0" id="comment_max_links" value="' . esc_attr(get_option('comment_max_links')) . '" class="small-text" />' ); ?></label></p> |
171 <p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="number" step="1" min="0" id="comment_max_links" value="' . esc_attr(get_option('comment_max_links')) . '" class="small-text" />' ); ?></label></p> |
153 |
172 |
154 <p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so “press” will match “WordPress”.'); ?></label></p> |
173 <p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so “press” will match “WordPress”.'); ?></label></p> |
155 <p> |
174 <p> |
156 <textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php echo esc_textarea( get_option( 'moderation_keys' ) ); ?></textarea> |
175 <textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php echo esc_textarea( get_option( 'moderation_keys' ) ); ?></textarea> |
157 </p> |
176 </p> |
158 </fieldset></td> |
177 </fieldset></td> |
159 </tr> |
178 </tr> |
160 <tr valign="top"> |
179 <tr> |
161 <th scope="row"><?php _e('Comment Blacklist'); ?></th> |
180 <th scope="row"><?php _e('Comment Blacklist'); ?></th> |
162 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Blacklist'); ?></span></legend> |
181 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Blacklist'); ?></span></legend> |
163 <p><label for="blacklist_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so “press” will match “WordPress”.'); ?></label></p> |
182 <p><label for="blacklist_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so “press” will match “WordPress”.'); ?></label></p> |
164 <p> |
183 <p> |
165 <textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php echo esc_textarea( get_option( 'blacklist_keys' ) ); ?></textarea> |
184 <textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php echo esc_textarea( get_option( 'blacklist_keys' ) ); ?></textarea> |
171 |
190 |
172 <h3 class="title"><?php _e('Avatars'); ?></h3> |
191 <h3 class="title"><?php _e('Avatars'); ?></h3> |
173 |
192 |
174 <p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your site.'); ?></p> |
193 <p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your site.'); ?></p> |
175 |
194 |
176 <?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?> |
195 <?php |
|
196 // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? |
|
197 |
|
198 $show_avatars = get_option( 'show_avatars' ); |
|
199 ?> |
177 |
200 |
178 <table class="form-table"> |
201 <table class="form-table"> |
179 <tr valign="top"> |
202 <tr> |
180 <th scope="row"><?php _e('Avatar Display'); ?></th> |
203 <th scope="row"><?php _e('Avatar Display'); ?></th> |
181 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend> |
204 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend> |
182 <label for="show_avatars"> |
205 <label for="show_avatars"> |
183 <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( get_option('show_avatars'), 1 ); ?> /> |
206 <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( $show_avatars, 1 ); ?> /> |
184 <?php _e( 'Show Avatars' ); ?> |
207 <?php _e( 'Show Avatars' ); ?> |
185 </label> |
208 </label> |
186 </fieldset></td> |
209 </fieldset></td> |
187 </tr> |
210 </tr> |
188 <tr valign="top"> |
211 <tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>"> |
189 <th scope="row"><?php _e('Maximum Rating'); ?></th> |
212 <th scope="row"><?php _e('Maximum Rating'); ?></th> |
190 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating'); ?></span></legend> |
213 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating'); ?></span></legend> |
191 |
214 |
192 <?php |
215 <?php |
193 $ratings = array( |
216 $ratings = array( |
206 endforeach; |
229 endforeach; |
207 ?> |
230 ?> |
208 |
231 |
209 </fieldset></td> |
232 </fieldset></td> |
210 </tr> |
233 </tr> |
211 <tr valign="top"> |
234 <tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>"> |
212 <th scope="row"><?php _e('Default Avatar'); ?></th> |
235 <th scope="row"><?php _e('Default Avatar'); ?></th> |
213 <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend> |
236 <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend> |
214 |
237 |
215 <?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br /> |
238 <?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br /> |
216 |
239 |
217 <?php |
240 <?php |
218 $avatar_defaults = array( |
241 $avatar_defaults = array( |
219 'mystery' => __('Mystery Man'), |
242 'mystery' => __('Mystery Person'), |
220 'blank' => __('Blank'), |
243 'blank' => __('Blank'), |
221 'gravatar_default' => __('Gravatar Logo'), |
244 'gravatar_default' => __('Gravatar Logo'), |
222 'identicon' => __('Identicon (Generated)'), |
245 'identicon' => __('Identicon (Generated)'), |
223 'wavatar' => __('Wavatar (Generated)'), |
246 'wavatar' => __('Wavatar (Generated)'), |
224 'monsterid' => __('MonsterID (Generated)'), |
247 'monsterid' => __('MonsterID (Generated)'), |
238 $default = get_option('avatar_default'); |
261 $default = get_option('avatar_default'); |
239 if ( empty($default) ) |
262 if ( empty($default) ) |
240 $default = 'mystery'; |
263 $default = 'mystery'; |
241 $size = 32; |
264 $size = 32; |
242 $avatar_list = ''; |
265 $avatar_list = ''; |
|
266 |
|
267 // Force avatars on to display these choices |
|
268 add_filter( 'pre_option_show_avatars', '__return_true', 100 ); |
|
269 |
243 foreach ( $avatar_defaults as $default_key => $default_name ) { |
270 foreach ( $avatar_defaults as $default_key => $default_name ) { |
244 $selected = ($default == $default_key) ? 'checked="checked" ' : ''; |
271 $selected = ($default == $default_key) ? 'checked="checked" ' : ''; |
245 $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> "; |
272 $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> "; |
246 |
273 |
247 $avatar = get_avatar( $user_email, $size, $default_key ); |
274 $avatar = get_avatar( $user_email, $size, $default_key ); |
248 $avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&forcedefault=1'", $avatar); |
275 $avatar = preg_replace( "/src='(.+?)'/", "src='\$1&forcedefault=1'", $avatar ); |
|
276 $avatar = preg_replace( "/srcset='(.+?) 2x'/", "srcset='\$1&forcedefault=1 2x'", $avatar ); |
|
277 $avatar_list .= $avatar; |
249 |
278 |
250 $avatar_list .= ' ' . $default_name . '</label>'; |
279 $avatar_list .= ' ' . $default_name . '</label>'; |
251 $avatar_list .= '<br />'; |
280 $avatar_list .= '<br />'; |
252 } |
281 } |
|
282 |
|
283 remove_filter( 'pre_option_show_avatars', '__return_true', 100 ); |
|
284 |
253 /** |
285 /** |
254 * Filter the HTML output of the default avatar list. |
286 * Filter the HTML output of the default avatar list. |
255 * |
287 * |
256 * @since 2.6.0 |
288 * @since 2.6.0 |
257 * |
289 * |