Ticket #34731: 34731.2.patch
File 34731.2.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 } elseif ( ! is_user_logged_in() ) { 2247 2248 if ( $first_field === $name ) { 2249 /** 2250 * Fires before the comment fields in the comment form. 2251 * 2252 * @since 3.0.0 2253 */ 2254 do_action( 'comment_form_before_fields' ); 2255 } 2256 2257 /** 2237 2258 * Filter a comment form field for display. 2238 2259 * 2239 2260 * The dynamic portion of the filter hook, `$name`, refers to the name … … 2244 2265 * @param string $field The HTML-formatted output of the comment form field. 2245 2266 */ 2246 2267 echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; 2268 2269 if ( $last_field === $name ) { 2270 /** 2271 * Fires after the comment fields in the comment form. 2272 * 2273 * @since 3.0.0 2274 */ 2275 do_action( 'comment_form_after_fields' ); 2276 } 2277 2247 2278 } 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 2279 2255 endif;2280 } 2256 2281 2282 echo $args['comment_notes_after']; 2283 2257 2284 $submit_button = sprintf( 2258 2285 $args['submit_button'], 2259 2286 esc_attr( $args['name_submit'] ),