WordPress.org

Make WordPress Core

Ticket #15534: wordpress-email-mod-update2.patch

File wordpress-email-mod-update2.patch, 4.1 KB (added by chalet16, 7 years ago)
  • wp-includes/comment.php

     
    13671367 * @param bool $wp_error Whether to return a WP_Error object if there is a failure. Default is false.
    13681368 * @return bool False on failure or deletion and true on success.
    13691369 */
    1370 function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
     1370function wp_set_comment_status($comment_id, $comment_status, $wp_error = false, $user_id = false) {
    13711371        global $wpdb;
    13721372
    13731373        $status = '0';
     
    13791379                case 'approve':
    13801380                case '1':
    13811381                        $status = '1';
     1382                        if( empty( $user_id ) )
     1383                                $user_id = get_current_user_id();
     1384                        update_comment_meta( $comment_id, 'approve_user', $user_id );
    13821385                        if ( get_option('comments_notify') ) {
    13831386                                $comment = get_comment($comment_id);
    13841387                                wp_notify_postauthor($comment_id, $comment->comment_type);
  • wp-includes/pluggable.php

     
    10101010        $comment = get_comment( $comment_id );
    10111011        $post    = get_post( $comment->comment_post_ID );
    10121012        $author  = get_userdata( $post->post_author );
     1013        $approve_user = get_comment_meta( $comment_id, 'approve_user', true );
     1014        $approve_userdata = ( !empty( $approve_user ) ) ? get_userdata( $approve_user ) : false;
    10131015
    10141016        // The comment was left by the author
    10151017        if ( $comment->user_id == $post->post_author )
     
    10381040                $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
    10391041                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
    10401042                $notify_message .= sprintf( __('Whois  : http://whois.arin.net/rest/ip/%s'), $comment->comment_author_IP ) . "\r\n";
     1043                if( !empty($approve_userdata) )
     1044                        $notify_message .= sprintf( __('Approved by  : %s'), $approve_userdata->user_nicename ) . "\r\n";
    10411045                $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
    10421046                $notify_message .= __('You can see all comments on this post here: ') . "\r\n";
    10431047                /* translators: 1: blog name, 2: post title */
     
    10471051                /* translators: 1: website name, 2: author IP, 3: author domain */
    10481052                $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
    10491053                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
     1054                if( !empty($approve_userdata) )
     1055                        $notify_message .= sprintf( __('Approved by  : %s'), $approve_userdata->user_nicename ) . "\r\n";
    10501056                $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
    10511057                $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";
    10521058                /* translators: 1: blog name, 2: post title */
     
    10561062                /* translators: 1: comment author, 2: author IP, 3: author domain */
    10571063                $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
    10581064                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
     1065                if( !empty($approve_userdata) )
     1066                        $notify_message .= sprintf( __('Approved by  : %s'), $approve_userdata->user_nicename ) . "\r\n";
    10591067                $notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n";
    10601068                $notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n";
    10611069                /* translators: 1: blog name, 2: post title */
     
    10691077                $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
    10701078        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
    10711079
     1080        if( !empty($approve_userdata) )
     1081                $subject .= sprintf( __(', approved by %s'), $approve_userdata->user_nicename );
    10721082        $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
    10731083
    10741084        if ( '' == $comment->comment_author ) {