WordPress.org

Make WordPress Core

Changeset 44681


Ignore:
Timestamp:
01/21/2019 10:45:51 PM (7 months ago)
Author:
pento
Message:

Comments: Update the message shown when a comment is awaiting moderation.

If the commenter doesn't have cookies set, they won't see the comment preview again. Showing an expanded message will help offset any confusion if they revisit the site later, and their comment is still in moderation, but they can't see it anymore.

Props azaozz, pento.
Fixes #44736.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-walker-comment.php

    r43571 r44681  
    264264            $add_below = 'div-comment';
    265265        }
     266
     267        $commenter = wp_get_current_commenter();
     268        if ( $commenter['comment_author_email'] ) {
     269            $moderation_note = __( 'Your comment is awaiting moderation.' );
     270        } else {
     271            $moderation_note = __( 'Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.' );
     272        }
     273
    266274        ?>
    267275        <<?php echo $tag; ?> <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?> id="comment-<?php comment_ID(); ?>">
     
    283291        </div>
    284292        <?php if ( '0' == $comment->comment_approved ) : ?>
    285         <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></em>
     293        <em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
    286294        <br />
    287295        <?php endif; ?>
     
    346354    protected function html5_comment( $comment, $depth, $args ) {
    347355        $tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
     356
     357        $commenter = wp_get_current_commenter();
     358        if ( $commenter['comment_author_email'] ) {
     359            $moderation_note = __( 'Your comment is awaiting moderation.' );
     360        } else {
     361            $moderation_note = __( 'Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.' );
     362        }
     363
    348364        ?>
    349365        <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?>>
     
    377393
    378394                    <?php if ( '0' == $comment->comment_approved ) : ?>
    379                     <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></p>
     395                    <em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
    380396                    <?php endif; ?>
    381397                </footer><!-- .comment-meta -->
Note: See TracChangeset for help on using the changeset viewer.