WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 4 months ago

#47461 closed defect (bug) (fixed)

The message "This is a preview, your comment will be visible after it has been approved." is not shown in all themes

Reported by: superpoincare Owned by: SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.1
Component: Bundled Theme Keywords: has-screenshots has-patch
Focuses: Cc:
PR Number:

Description

In #43857, there was a fix which among other things added the message

This is a preview, your comment will be visible after it has been approved.

But for reasons I am fascinated about, it doesn't appear in all themes when a comment is made and the commenter doesn't choose to opt-in with "Save my name, email, and website in this browser for the next time I comment."

Screenshots

Twenty Nineteen:

https://i.imgur.com/4iAUjEq.png

Twenty Seventeen:

https://i.imgur.com/N3hKpvw.png

Twenty Sixteen:

https://i.imgur.com/D4i7KWF.png

Twenty Fifteen:

https://i.imgur.com/kWWX1Tx.png

Twenty Fourteen:

https://i.imgur.com/FIoS5uE.png

Twenty Thirteen:

https://i.imgur.com/SkGV3dP.png

Twenty Twelve:

https://i.imgur.com/FGfrK93.png

Twenty Eleven:

https://i.imgur.com/e9mD3LW.png

Twenty Ten:

https://i.imgur.com/EpoaUUb.png

Attachments (1)

47461.diff (4.9 KB) - added by birgire 8 months ago.

Download all attachments as: .zip

Change History (8)

#1 @birgire
8 months ago

Good catch @superpoincare

Four default themes seems to override the native comment walker or parts of it that contains the adjusted comment moderation note:

1) Twenty Ten defines it's own callback:

wp_list_comments( array( 'callback' => 'twentyten_comment' ) ); )

https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-content/themes/twentyten/comments.php#L70

Here's the comment's moderation note in twentyten_comment():

https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-content/themes/twentyten/functions.php#L429

2) Twenty Eleven defines it's own callback:

wp_list_comments( array( 'callback' => 'twentyeleven_comment' ) );

https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-content/themes/twentyeleven/comments.php#L68

Here's the comment's moderation note in twentyeleven_comment():

https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-content/themes/twentyeleven/functions.php#L747

3) Twenty Twelve defines it's own callback:

wp_list_comments(
	array(
		'callback' => 'twentytwelve_comment',
		'style'    => 'ol',
	)
);

https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-content/themes/twentytwelve/comments.php#L51

Here's the comment's moderation note in twentytwelve_comment():

https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-content/themes/twentytwelve/functions.php#L446

4) Twenty Nineteen defines it's own walker:

wp_list_comments(
	array(
		'walker'      => new TwentyNineteen_Walker_Comment(),
		'avatar_size' => twentynineteen_get_avatar_size(),
		'short_ping'  => true,
		'style'       => 'ol',
	)
);

https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-content/themes/twentynineteen/comments.php#L76

The comment's moderation note from the custom walker:

https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-content/themes/twentynineteen/classes/class-twentynineteen-walker-comment.php#L99

#2 @birgire
8 months ago

  • Keywords has-screenshots added
  • Version changed from 5.2.1 to 5.1

#3 @superpoincare
8 months ago

Good findings. The text for comment awaiting moderation can be found in the callback function itself as in Twenty Twelve:

https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-content/themes/twentytwelve/functions.php#L446

@birgire
8 months ago

#4 @birgire
8 months ago

  • Keywords has-patch needs-testing added

@superpoincare here's a suggestion for a patch in 47461.diff. It might need some testing.

The wp_get_current_commenter() function was introduced in WordPress version 2.0.4, from the year 2006, so it should have existed before Twenty Ten was introduced.

#5 @ianbelanger
8 months ago

  • Keywords needs-testing removed
  • Milestone changed from Awaiting Review to 5.3

47461.diff applies cleanly and seems to fix the comment moderation message in the 4 affected themes. Adding this to 5.3 milestone.

Thanks for the patch @birgire and for reporting @superpoincare!

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.


5 months ago

#7 @SergeyBiryukov
4 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 46117:

Bundled Themes: 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 birgire, superpoincare.
Fixes #47461. See #43857.

Note: See TracTickets for help on using tickets.