From c7bab2b410e92e1e028a6d93f354355684960e0b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 27 Jan 2020 04:33:04 +0000 Subject: [PATCH] Comments: Add `In reply to: %s` parent comment link to new comment email notifications. This information was previously available on the Moderate Comment screen in the admin, but was missing from moderation emails. Props imath, danieltj, andraganescu, galbaras, SergeyBiryukov. Fixes #43805. See #43429. Built from https://develop.svn.wordpress.org/trunk@47114 git-svn-id: http://core.svn.wordpress.org/trunk@46914 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/pluggable.php | 17 +++++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index a741ac4e78..2d350d1d5f 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -1584,6 +1584,7 @@ if ( ! function_exists( 'wp_notify_postauthor' ) ) : /* translators: Trackback notification email subject. 1: Site title, 2: Post title. */ $subject = sprintf( __( '[%1$s] Trackback: "%2$s"' ), $blogname, $post->post_title ); break; + case 'pingback': /* translators: %s: Post title. */ $notify_message = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n"; @@ -1597,6 +1598,7 @@ if ( ! function_exists( 'wp_notify_postauthor' ) ) : /* translators: Pingback notification email subject. 1: Site title, 2: Post title. */ $subject = sprintf( __( '[%1$s] Pingback: "%2$s"' ), $blogname, $post->post_title ); break; + default: // Comments /* translators: %s: Post title. */ $notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n"; @@ -1606,6 +1608,12 @@ if ( ! function_exists( 'wp_notify_postauthor' ) ) : $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n"; /* translators: %s: Trackback/pingback/comment author URL. */ $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; + + if ( $comment->comment_parent && user_can( $post->post_author, 'edit_comment', $comment->comment_parent ) ) { + /* translators: Comment moderation. %s: Parent comment edit URL. */ + $notify_message .= sprintf( __( 'In reply to: %s' ), admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ) . "\r\n"; + } + /* translators: %s: Comment text. */ $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n"; $notify_message .= __( 'You can see all comments on this post here:' ) . "\r\n"; @@ -1613,6 +1621,7 @@ if ( ! function_exists( 'wp_notify_postauthor' ) ) : $subject = sprintf( __( '[%1$s] Comment: "%2$s"' ), $blogname, $post->post_title ); break; } + $notify_message .= get_permalink( $comment->comment_post_ID ) . "#comments\r\n\r\n"; /* translators: %s: Comment URL. */ $notify_message .= sprintf( __( 'Permalink: %s' ), get_comment_link( $comment ) ) . "\r\n"; @@ -1761,6 +1770,7 @@ if ( ! function_exists( 'wp_notify_moderator' ) ) : $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; $notify_message .= __( 'Trackback excerpt: ' ) . "\r\n" . $comment_content . "\r\n\r\n"; break; + case 'pingback': /* translators: %s: Post title. */ $notify_message = sprintf( __( 'A new pingback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n"; @@ -1771,6 +1781,7 @@ if ( ! function_exists( 'wp_notify_moderator' ) ) : $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; $notify_message .= __( 'Pingback excerpt: ' ) . "\r\n" . $comment_content . "\r\n\r\n"; break; + default: // Comments /* translators: %s: Post title. */ $notify_message = sprintf( __( 'A new comment on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n"; @@ -1781,6 +1792,12 @@ if ( ! function_exists( 'wp_notify_moderator' ) ) : $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n"; /* translators: %s: Trackback/pingback/comment author URL. */ $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; + + if ( $comment->comment_parent ) { + /* translators: Comment moderation. %s: Parent comment edit URL. */ + $notify_message .= sprintf( __( 'In reply to: %s' ), admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ) . "\r\n"; + } + /* translators: %s: Comment text. */ $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n"; break; diff --git a/wp-includes/version.php b/wp-includes/version.php index 9389156e48..f96151bbe5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-47113'; +$wp_version = '5.4-alpha-47114'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.