Ticket #761: 761.5.diff
File 761.5.diff, 3.5 KB (added by , 9 years ago) |
---|
-
src/wp-includes/comment-functions.php
1624 1624 * 1625 1625 * @since 1.2.0 1626 1626 * 1627 * Calls {@see 'wp_notify_post_author'} to determine if the post author should be 1628 * notified. Calls {@see 'wp_notify_moderator'} to determine if the site moderator 1629 * should be notified. 1630 * 1627 1631 * @param int $comment_ID The comment ID. 1628 1632 * @param int $comment_approved 1 (true) if the comment is approved, 0 (false) if not. 1629 1633 */ … … 1631 1635 1632 1636 if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching 1633 1637 if ( '0' == $commentdata['comment_approved'] ) { 1634 wp_notify_moderator( $comment_ID ); 1638 1639 $maybe_notify = get_option( 'moderation_notify' ); 1640 1641 /** 1642 * Filter the blog moderator email notification setting. 1643 * 1644 * @since 4.4.0 1645 * 1646 * @param bool $maybe_notify Whether to notify blog moderator. 1647 * @param int $comment_ID The id of the comment for the notification. 1648 */ 1649 if ( apply_filters( 'wp_notify_moderator', $maybe_notify, $comment_ID ) ) { 1650 wp_notify_moderator( $comment_ID ); 1651 } 1635 1652 } 1636 1653 1654 $maybe_notify = get_option( 'comments_notify' ) && $commentdata['comment_approved']; 1655 1656 /** 1657 * Filter the post author email notification setting. 1658 * 1659 * @since 4.4.0 1660 * 1661 * @param bool $maybe_notify Whether to notify post author. 1662 * @param int $comment_ID The id of the comment for the notification. 1663 */ 1664 $maybe_notify = apply_filters( 'wp_notify_post_author', $maybe_notify, $comment_ID ); 1637 1665 // wp_notify_postauthor() checks if notifying the author of their own comment. 1638 1666 // By default, it won't, but filters can override this. 1639 if ( get_option( 'comments_notify' ) && $commentdata['comment_approved']) {1667 if ( $maybe_notify ) { 1640 1668 wp_notify_postauthor( $comment_ID ); 1641 1669 } 1642 1670 } … … 1652 1680 * 1653 1681 * @since 1.0.0 1654 1682 * 1683 * Calls {@see 'wp_notify_post_author'} to determine if the post author should be 1684 * notified. 1685 * 1655 1686 * global wpdb $wpdb 1656 1687 * 1657 1688 * @param int $comment_id Comment ID. … … 1670 1701 case 'approve': 1671 1702 case '1': 1672 1703 $status = '1'; 1673 if ( get_option('comments_notify') ) { 1704 $maybe_notify = get_option( 'comments_notify' ); 1705 1706 /** This filter is documented in wp-includes/comment-functions.php */ 1707 $maybe_notify = apply_filters( 'wp_notify_post_author', $maybe_notify, $comment_id ); 1708 if ( $maybe_notify ) { 1674 1709 wp_notify_postauthor( $comment_id ); 1675 1710 } 1676 1711 break; -
src/wp-includes/pluggable.php
1546 1546 * 1547 1547 * @global wpdb $wpdb WordPress database abstraction object. 1548 1548 * 1549 * 1550 * @uses apply_filters() Calls 'wp_notify_moderator' to determine if blog moderator 1551 * should be notified. 1552 * 1549 1553 * @param int $comment_id Comment ID 1550 1554 * @return true Always returns true 1551 1555 */ … … 1552 1556 function wp_notify_moderator($comment_id) { 1553 1557 global $wpdb; 1554 1558 1555 if ( 0 == get_option( 'moderation_notify' ) ) 1559 $maybe_notify = get_option( 'moderation_notify' ); 1560 1561 /** This filter is documented in wp-includes/comment-functions.php */ 1562 if ( ! apply_filters( 'wp_notify_moderator', $maybe_notify, $comment_id ) ) { 1556 1563 return true; 1564 } 1557 1565 1558 1566 $comment = get_comment($comment_id); 1559 1567 $post = get_post($comment->comment_post_ID);