Make WordPress Core


Ignore:
Timestamp:
07/10/2013 10:01:12 PM (12 years ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/pluggable.php

    r24530 r24649  
    990990    $author  = get_userdata( $post->post_author );
    991991
    992     // The post author is no longer a member of the blog
    993     if ( ! is_user_member_of_blog( $post->post_author ) )
    994         return false;
    995 
    996992    // The comment was left by the author
    997993    if ( $comment->user_id == $post->post_author )
     
    1000996    // The author moderated a comment on his own post
    1001997    if ( $post->post_author == get_current_user_id() )
     998        return false;
     999
     1000    // The post author is no longer a member of the blog
     1001    if ( ! user_can( $post->post_author, 'read_post', $post->ID ) )
    10021002        return false;
    10031003
     
    10461046    $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
    10471047    $notify_message .= sprintf( __('Permalink: %s'), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n";
    1048     if ( EMPTY_TRASH_DAYS )
    1049         $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
    1050     else
    1051         $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
    1052     $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
     1048
     1049    if ( user_can( $post->post_author, 'edit_comment', $comment_id ) ) {
     1050        if ( EMPTY_TRASH_DAYS )
     1051            $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
     1052        else
     1053            $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
     1054        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
     1055    }
    10531056
    10541057    $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
Note: See TracChangeset for help on using the changeset viewer.