diff --git src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php
index 829bb515b7..6a758e3a48 100644
|
|
class TwentyNineteen_Walker_Comment extends Walker_Comment { |
25 | 25 | */ |
26 | 26 | protected function html5_comment( $comment, $depth, $args ) { |
27 | 27 | |
28 | | $tag = ( 'div' === $args['style'] ) ? 'div' : 'li'; |
| 28 | $tag = ( 'div' === $args['style'] ) ? 'div' : 'li'; |
| 29 | $commenter = wp_get_current_commenter(); |
| 30 | $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author']; |
29 | 31 | |
30 | 32 | ?> |
31 | 33 | <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?>> |
… |
… |
class TwentyNineteen_Walker_Comment extends Walker_Comment { |
34 | 36 | <div class="comment-author vcard"> |
35 | 37 | <?php |
36 | 38 | $comment_author_url = get_comment_author_url( $comment ); |
| 39 | if ( '0' == $comment->comment_approved && ! $show_pending_links ) { |
| 40 | $comment_author_url = ''; |
| 41 | } |
| 42 | |
37 | 43 | $comment_author = get_comment_author( $comment ); |
38 | 44 | $avatar = get_avatar( $comment, $args['avatar_size'] ); |
39 | 45 | if ( 0 != $args['avatar_size'] ) { |
… |
… |
class TwentyNineteen_Walker_Comment extends Walker_Comment { |
89 | 95 | </div><!-- .comment-metadata --> |
90 | 96 | |
91 | 97 | <?php |
92 | | $commenter = wp_get_current_commenter(); |
93 | 98 | if ( $commenter['comment_author_email'] ) { |
94 | 99 | $moderation_note = __( 'Your comment is awaiting moderation.', 'twentynineteen' ); |
95 | 100 | } else { |
96 | | $moderation_note = __( 'Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.', 'twentynineteen' ); |
| 101 | $moderation_note = __( 'Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.', 'twentynineteen' ); |
97 | 102 | } |
98 | 103 | ?> |
99 | 104 | |
diff --git src/wp-includes/class-walker-comment.php src/wp-includes/class-walker-comment.php
index 7325fd0a6a..3073ce8536 100644
|
|
class Walker_Comment extends Walker { |
181 | 181 | return; |
182 | 182 | } |
183 | 183 | |
| 184 | if ( 'comment' === $comment->comment_type ) { |
| 185 | add_filter( 'comment_text', array( $this, 'comment_text' ), 40, 2 ); |
| 186 | } |
| 187 | |
184 | 188 | if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) { |
185 | 189 | ob_start(); |
186 | 190 | $this->ping( $comment, $depth, $args ); |
… |
… |
class Walker_Comment extends Walker { |
194 | 198 | $this->comment( $comment, $depth, $args ); |
195 | 199 | $output .= ob_get_clean(); |
196 | 200 | } |
| 201 | |
| 202 | if ( 'comment' === $comment->comment_type ) { |
| 203 | remove_filter( 'comment_text', array( $this, 'comment_text' ), 40, 2 ); |
| 204 | } |
197 | 205 | } |
198 | 206 | |
199 | 207 | /** |
… |
… |
class Walker_Comment extends Walker { |
244 | 252 | <?php |
245 | 253 | } |
246 | 254 | |
| 255 | /** |
| 256 | * Remove links from the pending comment's text if the commenter has not consent to the comment cookie. |
| 257 | * |
| 258 | * @since 5.4.2 |
| 259 | * |
| 260 | * @param string $comment_text Text of the current comment. |
| 261 | * @param WP_Comment|null $comment The comment object. |
| 262 | * @return string Text of the current comment. |
| 263 | */ |
| 264 | function comment_text( $comment_text, $comment ) { |
| 265 | $commenter = wp_get_current_commenter(); |
| 266 | $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author']; |
| 267 | |
| 268 | if ( '0' == $comment->comment_approved && ! $show_pending_links ) { |
| 269 | return wp_kses( $comment_text, array() ); |
| 270 | } |
| 271 | |
| 272 | return $comment_text; |
| 273 | } |
| 274 | |
247 | 275 | /** |
248 | 276 | * Outputs a single comment. |
249 | 277 | * |
… |
… |
class Walker_Comment extends Walker { |
264 | 292 | $add_below = 'div-comment'; |
265 | 293 | } |
266 | 294 | |
267 | | $commenter = wp_get_current_commenter(); |
| 295 | $commenter = wp_get_current_commenter(); |
| 296 | $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author']; |
268 | 297 | if ( $commenter['comment_author_email'] ) { |
269 | 298 | $moderation_note = __( 'Your comment is awaiting moderation.' ); |
270 | 299 | } else { |
… |
… |
class Walker_Comment extends Walker { |
282 | 311 | echo get_avatar( $comment, $args['avatar_size'] );} |
283 | 312 | ?> |
284 | 313 | <?php |
| 314 | $comment_author = get_comment_author_link( $comment ); |
| 315 | if ( '0' == $comment->comment_approved && ! $show_pending_links ) { |
| 316 | $comment_author = get_comment_author( $comment ); |
| 317 | } |
| 318 | |
285 | 319 | printf( |
286 | 320 | /* translators: %s: Comment author link. */ |
287 | 321 | __( '%s <span class="says">says:</span>' ), |
288 | | sprintf( '<cite class="fn">%s</cite>', get_comment_author_link( $comment ) ) |
| 322 | sprintf( '<cite class="fn">%s</cite>', $comment_author ) |
289 | 323 | ); |
290 | 324 | ?> |
291 | 325 | </div> |
… |
… |
class Walker_Comment extends Walker { |
354 | 388 | protected function html5_comment( $comment, $depth, $args ) { |
355 | 389 | $tag = ( 'div' === $args['style'] ) ? 'div' : 'li'; |
356 | 390 | |
357 | | $commenter = wp_get_current_commenter(); |
| 391 | $commenter = wp_get_current_commenter(); |
| 392 | $show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author']; |
358 | 393 | if ( $commenter['comment_author_email'] ) { |
359 | 394 | $moderation_note = __( 'Your comment is awaiting moderation.' ); |
360 | 395 | } else { |
… |
… |
class Walker_Comment extends Walker { |
372 | 407 | } |
373 | 408 | ?> |
374 | 409 | <?php |
| 410 | $comment_author = get_comment_author_link( $comment ); |
| 411 | if ( '0' == $comment->comment_approved && ! $show_pending_links ) { |
| 412 | $comment_author = get_comment_author( $comment ); |
| 413 | } |
| 414 | |
375 | 415 | printf( |
376 | 416 | /* translators: %s: Comment author link. */ |
377 | 417 | __( '%s <span class="says">says:</span>' ), |
378 | | sprintf( '<b class="fn">%s</b>', get_comment_author_link( $comment ) ) |
| 418 | sprintf( '<b class="fn">%s</b>', $comment_author ) |
379 | 419 | ); |
380 | 420 | ?> |
381 | 421 | </div><!-- .comment-author --> |
diff --git src/wp-includes/comment.php src/wp-includes/comment.php
index 8648a89a0f..9139bb1b7c 100644
|
|
function wp_get_unapproved_comment_author_email() { |
1847 | 1847 | $comment = get_comment( $comment_id ); |
1848 | 1848 | |
1849 | 1849 | if ( $comment && hash_equals( $_GET['moderation-hash'], wp_hash( $comment->comment_date_gmt ) ) ) { |
1850 | | $commenter_email = $comment->comment_author_email; |
| 1850 | // The comment will only be viewable by the comment author for 1 minute. |
| 1851 | $comment_timestamp = strtotime( $comment->comment_date_gmt . '+1 minute' ); |
| 1852 | $current_timestamp = strtotime( current_time( 'mysql', 1 ) ); |
| 1853 | |
| 1854 | if ( $current_timestamp < $comment_timestamp ) { |
| 1855 | $commenter_email = $comment->comment_author_email; |
| 1856 | } |
1851 | 1857 | } |
1852 | 1858 | } |
1853 | 1859 | |