Make WordPress Core


Ignore:
Timestamp:
09/14/2015 09:39:46 PM (11 years ago)
Author:
wonderboymusic
Message:

More comment functions can accept a full object instead of comment_ID to reduce cache/db lookups.

See ##33638.

File:
1 edited

Legend:

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

    r34125 r34129  
    13541354 * @since 1.0.0
    13551355 *
    1356  * @param int    $comment_id Comment ID
    1357  * @param string $deprecated Not used
     1356 * @param int|WP_Comment  $comment_id Comment ID or WP_Comment object.
     1357 * @param string          $deprecated Not used
    13581358 * @return bool True on completion. False if no email addresses were specified.
    13591359 */
    … …  
    13871387         * @param int   $comment_id The comment ID.
    13881388         */
    1389         $emails = apply_filters( 'comment_notification_recipients', $emails, $comment_id );
     1389        $emails = apply_filters( 'comment_notification_recipients', $emails, $comment->comment_ID );
    13901390        $emails = array_filter( $emails );
    13911391
    … …  
    14101410         * @param int  $comment_id The comment ID.
    14111411         */
    1412         $notify_author = apply_filters( 'comment_notification_notify_author', false, $comment_id );
     1412        $notify_author = apply_filters( 'comment_notification_notify_author', false, $comment->comment_ID );
    14131413
    14141414        // The comment was left by the author
    … …  
    14761476        $notify_message .= sprintf( __('Permalink: %s'), get_comment_link( $comment ) ) . "\r\n";
    14771477
    1478         if ( user_can( $post->post_author, 'edit_comment', $comment_id ) ) {
    1479                 if ( EMPTY_TRASH_DAYS )
    1480                         $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
    1481                 else
    1482                         $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
    1483                 $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
     1478        if ( user_can( $post->post_author, 'edit_comment', $comment->comment_ID ) ) {
     1479                if ( EMPTY_TRASH_DAYS ) {
     1480                        $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c={$comment->comment_ID}") ) . "\r\n";
     1481                } else {
     1482                        $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c={$comment->comment_ID}") ) . "\r\n";
     1483                }
     1484                $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c={$comment->comment_ID}") ) . "\r\n";
    14841485        }
    14851486
    … …  
    15101511         * @param int    $comment_id     Comment ID.
    15111512         */
    1512         $notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment_id );
     1513        $notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment->comment_ID );
    15131514
    15141515        /**
    … …  
    15201521         * @param int    $comment_id Comment ID.
    15211522         */
    1522         $subject = apply_filters( 'comment_notification_subject', $subject, $comment_id );
     1523        $subject = apply_filters( 'comment_notification_subject', $subject, $comment->comment_ID );
    15231524
    15241525        /**
    … …  
    15301531         * @param int    $comment_id      Comment ID.
    15311532         */
    1532         $message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment_id );
     1533        $message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment->comment_ID );
    15331534
    15341535        foreach ( $emails as $email ) {
Note: See TracChangeset for help on using the changeset viewer.