Do not notify the post author about comments if they are no longer a member of the blog.
This updates [23294] to use capability checks to determine if the user can still edit a post, which works for super admins. Additionally, it hides Trash/Spam action links when the user is still a member of the blog but cannot (or can no longer) moderate the comment. fixes #23136. git-svn-id: http://core.svn.wordpress.org/trunk@24649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0c5811461a
commit
0f84b87380
|
@ -989,10 +989,6 @@ function wp_notify_postauthor( $comment_id, $comment_type = '' ) {
|
|||
$post = get_post( $comment->comment_post_ID );
|
||||
$author = get_userdata( $post->post_author );
|
||||
|
||||
// The post author is no longer a member of the blog
|
||||
if ( ! is_user_member_of_blog( $post->post_author ) )
|
||||
return false;
|
||||
|
||||
// The comment was left by the author
|
||||
if ( $comment->user_id == $post->post_author )
|
||||
return false;
|
||||
|
@ -1001,6 +997,10 @@ function wp_notify_postauthor( $comment_id, $comment_type = '' ) {
|
|||
if ( $post->post_author == get_current_user_id() )
|
||||
return false;
|
||||
|
||||
// The post author is no longer a member of the blog
|
||||
if ( ! user_can( $post->post_author, 'read_post', $post->ID ) )
|
||||
return false;
|
||||
|
||||
// If there's no email to send the comment to
|
||||
if ( '' == $author->user_email )
|
||||
return false;
|
||||
|
@ -1045,11 +1045,14 @@ function wp_notify_postauthor( $comment_id, $comment_type = '' ) {
|
|||
}
|
||||
$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
|
||||
$notify_message .= sprintf( __('Permalink: %s'), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n";
|
||||
if ( EMPTY_TRASH_DAYS )
|
||||
$notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
|
||||
else
|
||||
$notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
|
||||
$notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
|
||||
|
||||
if ( user_can( $post->post_author, 'edit_comment', $comment_id ) ) {
|
||||
if ( EMPTY_TRASH_DAYS )
|
||||
$notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
|
||||
else
|
||||
$notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
|
||||
$notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
|
||||
}
|
||||
|
||||
$wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
|
||||
|
||||
|
|
Loading…
Reference in New Issue