Ticket #34731: 34731.patch
File 34731.patch, 2.9 KB (added by , 9 years ago) |
---|
-
src/wp-includes/comment-template.php
2214 2214 2215 2215 endif; 2216 2216 2217 $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields']; 2218 2217 2219 /** 2218 * Filter the co ntent of the comment textarea field for display.2220 * Filter the comment form fields. 2219 2221 * 2220 * @since 3.0.02222 * @since 4.4.0 2221 2223 * 2222 * @param string $args_comment_field The content of the comment textarea field.2224 * @param array $comment_fields The comment fields. 2223 2225 */ 2224 echo apply_filters( 'comment_form_field_comment', $args['comment_field']);2226 $comment_fields = apply_filters( 'comment_form_fields', $comment_fields ); 2225 2227 2226 echo $args['comment_notes_after'];2228 $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) ); 2227 2229 2228 if ( ! is_user_logged_in() ) : 2229 /** 2230 * Fires before the comment fields in the comment form. 2231 * 2232 * @since 3.0.0 2233 */ 2234 do_action( 'comment_form_before_fields' ); 2235 foreach ( (array) $args['fields'] as $name => $field ) { 2230 $first_field = reset( $comment_field_keys ); 2231 $last_field = end( $comment_field_keys ); 2232 2233 foreach ( $comment_fields as $name => $field ) { 2234 2235 if ( 'comment' === $name ) { 2236 2236 2237 /** 2238 * Filter the content of the comment textarea field for display. 2239 * 2240 * @since 3.0.0 2241 * 2242 * @param string $args_comment_field The content of the comment textarea field. 2243 */ 2244 echo apply_filters( 'comment_form_field_comment', $field ); 2245 2246 echo $args['comment_notes_after']; 2247 2248 } elseif ( ! is_user_logged_in() ) { 2249 2250 if ( $first_field === $name ) { 2251 /** 2252 * Fires before the comment fields in the comment form. 2253 * 2254 * @since 3.0.0 2255 */ 2256 do_action( 'comment_form_before_fields' ); 2257 } 2258 2259 /** 2237 2260 * Filter a comment form field for display. 2238 2261 * 2239 2262 * The dynamic portion of the filter hook, `$name`, refers to the name … … 2244 2267 * @param string $field The HTML-formatted output of the comment form field. 2245 2268 */ 2246 2269 echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; 2270 2271 if ( $last_field === $name ) { 2272 /** 2273 * Fires after the comment fields in the comment form. 2274 * 2275 * @since 3.0.0 2276 */ 2277 do_action( 'comment_form_after_fields' ); 2278 } 2279 2247 2280 } 2248 /**2249 * Fires after the comment fields in the comment form.2250 *2251 * @since 3.0.02252 */2253 do_action( 'comment_form_after_fields' );2254 2281 2255 endif;2282 } 2256 2283 2257 2284 $submit_button = sprintf( 2258 2285 $args['submit_button'],