Comments: In `comment_form()`, move the comment textarea to the top for logged-out users when replying, improves keyboard/focus navigation.

Rehabilitate errant tabbing and extra unnecessary `<?php ?>` toggling.

Props afercia, adamsilverstein.
Fixes #29974.

Built from https://develop.svn.wordpress.org/trunk@34525


git-svn-id: http://core.svn.wordpress.org/trunk@34489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-24 22:00:28 +00:00
parent 59279c5f8b
commit 498b2d7e33
2 changed files with 166 additions and 168 deletions

View File

@ -1974,7 +1974,7 @@ function comment_form( $args = array(), $post_id = null ) {
/** This filter is documented in wp-includes/link-template.php */
'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
/** This filter is documented in wp-includes/link-template.php */
'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( '<a href="%1$s" aria-label="Logged in as %2$s. Edit your profile.">Logged in as %2$s</a>. <a href="%3$s">Log out?</a>' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
'comment_notes_before' => '<p class="comment-notes"><span id="email-notes">' . __( 'Your email address will not be published.' ) . '</span>'. ( $req ? $required_text : '' ) . '</p>',
'comment_notes_after' => '',
'id_form' => 'commentform',
@ -2030,19 +2030,16 @@ function comment_form( $args = array(), $post_id = null ) {
echo $args['cancel_reply_after'];
echo $args['title_reply_after'];
?>
<?php if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) : ?>
<?php echo $args['must_log_in']; ?>
<?php
if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) :
echo $args['must_log_in'];
/**
* Fires after the HTML-formatted 'must log in after' message in the comment form.
*
* @since 3.0.0
*/
do_action( 'comment_form_must_log_in_after' );
?>
<?php else : ?>
else : ?>
<form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="<?php echo esc_attr( $args['id_form'] ); ?>" class="comment-form"<?php echo $html5 ? ' novalidate' : ''; ?>>
<?php
/**
@ -2051,9 +2048,8 @@ function comment_form( $args = array(), $post_id = null ) {
* @since 3.0.0
*/
do_action( 'comment_form_top' );
?>
<?php if ( is_user_logged_in() ) : ?>
<?php
if ( is_user_logged_in() ) :
/**
* Filter the 'logged in' message for the comment form for display.
*
@ -2066,8 +2062,7 @@ function comment_form( $args = array(), $post_id = null ) {
* the display name, blank otherwise.
*/
echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity );
?>
<?php
/**
* Fires after the is_user_logged_in() check in the comment form.
*
@ -2079,10 +2074,25 @@ function comment_form( $args = array(), $post_id = null ) {
* the display name, blank otherwise.
*/
do_action( 'comment_form_logged_in_after', $commenter, $user_identity );
?>
<?php else : ?>
<?php echo $args['comment_notes_before']; ?>
<?php
else :
echo $args['comment_notes_before'];
endif;
/**
* Filter the content of the comment textarea field for display.
*
* @since 3.0.0
*
* @param string $args_comment_field The content of the comment textarea field.
*/
echo apply_filters( 'comment_form_field_comment', $args['comment_field'] );
echo $args['comment_notes_after'];
if ( ! is_user_logged_in() ) :
/**
* Fires before the comment fields in the comment form.
*
@ -2108,21 +2118,9 @@ function comment_form( $args = array(), $post_id = null ) {
* @since 3.0.0
*/
do_action( 'comment_form_after_fields' );
?>
<?php endif; ?>
<?php
/**
* Filter the content of the comment textarea field for display.
*
* @since 3.0.0
*
* @param string $args_comment_field The content of the comment textarea field.
*/
echo apply_filters( 'comment_form_field_comment', $args['comment_field'] );
?>
<?php echo $args['comment_notes_after']; ?>
<?php
endif;
$submit_button = sprintf(
$args['submit_button'],
esc_attr( $args['name_submit'] ),

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34524';
$wp_version = '4.4-alpha-34525';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.