WordPress.org

Make WordPress Core

Ticket #14510: t14510-comment-notes-before-position-condition.diff

File t14510-comment-notes-before-position-condition.diff, 2.3 KB (added by demetris, 10 years ago)

Moves comment_notes_before, and gives it value only if the user is not logged in

  • wp-includes/comment-template.php

     
    15331533                'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
    15341534                '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>',
    15351535                '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>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
    1536                 'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
     1536                'comment_notes_before' => is_user_logged_in() ? '' : '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
    15371537                'comment_notes_after'  => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>',
    15381538                'id_form'              => 'commentform',
    15391539                'id_submit'            => 'submit',
     
    15561556                                <?php else : ?>
    15571557                                        <form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="<?php echo esc_attr( $args['id_form'] ); ?>">
    15581558                                                <?php do_action( 'comment_form_top' ); ?>
     1559                                                <?php echo $args['comment_notes_before']; ?>
    15591560                                                <?php if ( is_user_logged_in() ) : ?>
    15601561                                                        <?php echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); ?>
    15611562                                                        <?php do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); ?>
    15621563                                                <?php else : ?>
    1563                                                         <?php echo $args['comment_notes_before']; ?>
    15641564                                                        <?php
    15651565                                                        do_action( 'comment_form_before_fields' );
    15661566                                                        foreach ( (array) $args['fields'] as $name => $field ) {