Ticket #34731: 34731.5.patch
File 34731.5.patch, 4.1 KB (added by , 9 years ago) |
---|
-
src/wp-includes/comment-template.php
2037 2037 * @type string $comment_field The comment textarea field HTML. 2038 2038 * @type string $must_log_in HTML element for a 'must be logged in to comment' message. 2039 2039 * @type string $logged_in_as HTML element for a 'logged in as [user]' message. 2040 * @type string $comment_notes_before HTML element for a message displayed before the comment form. 2040 * @type string $comment_notes_before HTML element for a message displayed before the comment fields 2041 * if the user is not logged in. 2041 2042 * Default 'Your email address will not be published.'. 2042 * @type string $comment_notes_after HTML element for a message displayed after the comment form.2043 * @type string $comment_notes_after HTML element for a message displayed after the textarea field. 2043 2044 * @type string $id_form The comment form element id attribute. Default 'commentform'. 2044 2045 * @type string $id_submit The comment submit element id attribute. Default 'submit'. 2045 2046 * @type string $class_form The comment form element class attribute. Default 'comment-form'. … … 2214 2215 2215 2216 endif; 2216 2217 2218 $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields']; 2219 2217 2220 /** 2218 * Filter the co ntent of the comment textarea field for display.2221 * Filter the comment form fields. 2219 2222 * 2220 * @since 3.0.02223 * @since 4.4.0 2221 2224 * 2222 * @param string $args_comment_field The content of the comment textarea field.2225 * @param array $comment_fields The comment fields. 2223 2226 */ 2224 echo apply_filters( 'comment_form_field_comment', $args['comment_field']);2227 $comment_fields = apply_filters( 'comment_form_fields', $comment_fields ); 2225 2228 2226 echo $args['comment_notes_after'];2229 $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) ); 2227 2230 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 ) { 2231 $first_field = reset( $comment_field_keys ); 2232 $last_field = end( $comment_field_keys ); 2233 2234 foreach ( $comment_fields as $name => $field ) { 2235 2236 if ( 'comment' === $name ) { 2237 2236 2238 /** 2239 * Filter the content of the comment textarea field for display. 2240 * 2241 * @since 3.0.0 2242 * 2243 * @param string $args_comment_field The content of the comment textarea field. 2244 */ 2245 echo apply_filters( 'comment_form_field_comment', $field ); 2246 2247 echo $args['comment_notes_after']; 2248 2249 } elseif ( ! is_user_logged_in() ) { 2250 2251 if ( $first_field === $name ) { 2252 /** 2253 * Fires before the comment fields in the comment form, excluding the textarea. 2254 * 2255 * @since 3.0.0 2256 */ 2257 do_action( 'comment_form_before_fields' ); 2258 } 2259 2260 /** 2237 2261 * Filter a comment form field for display. 2238 2262 * 2239 2263 * The dynamic portion of the filter hook, `$name`, refers to the name … … 2244 2268 * @param string $field The HTML-formatted output of the comment form field. 2245 2269 */ 2246 2270 echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; 2271 2272 if ( $last_field === $name ) { 2273 /** 2274 * Fires after the comment fields in the comment form, excluding the textarea. 2275 * 2276 * @since 3.0.0 2277 */ 2278 do_action( 'comment_form_after_fields' ); 2279 } 2247 2280 } 2248 /** 2249 * Fires after the comment fields in the comment form. 2250 * 2251 * @since 3.0.0 2252 */ 2253 do_action( 'comment_form_after_fields' ); 2281 } 2254 2282 2255 endif;2256 2257 2283 $submit_button = sprintf( 2258 2284 $args['submit_button'], 2259 2285 esc_attr( $args['name_submit'] ),