Ticket #761: 761.4.diff
File 761.4.diff, 3.6 KB (added by , 10 years ago) |
---|
-
src/wp-includes/comment-functions.php
1631 1631 * 1632 1632 * @since 1.2.0 1633 1633 * 1634 * @uses apply_filters() Calls 'wp_notify_post_author' to determine if post 1635 * author should be notified. Calls 'wp_notify_moderator' 1636 * to determine if blog moderator should be notified. 1637 * 1634 1638 * @param int $comment_ID The comment ID. 1635 1639 * @param int $comment_approved 1 (true) if the comment is approved, 0 (false) if not. 1636 1640 */ … … 1638 1642 1639 1643 if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching 1640 1644 if ( '0' == $commentdata['comment_approved'] ) { 1641 wp_notify_moderator( $comment_ID ); 1645 1646 $maybe_notify = get_option( 'moderation_notify' ); 1647 /** 1648 * Filter the blog moderator email notification setting. 1649 * 1650 * @since 4.4.0 1651 * 1652 * @param bool $maybe_notify Whether to notify blog moderator. 1653 * @param int $comment_ID The id of the comment for the notification. 1654 */ 1655 if ( apply_filters( 'wp_notify_moderator', $maybe_notify, $comment_ID ) ) { 1656 wp_notify_moderator( $comment_ID ); 1657 } 1642 1658 } 1643 1659 1660 $maybe_notify = get_option( 'comments_notify' ) && $commentdata['comment_approved']; 1661 1662 /** 1663 * Filter the post author email notification setting. 1664 * 1665 * @since 4.4.0 1666 * 1667 * @param bool $maybe_notify Whether to notify post author. 1668 * @param int $comment_ID The id of the comment for the notification. 1669 */ 1670 $maybe_notify = apply_filters( 'wp_notify_post_author', $maybe_notify, $comment_ID ); 1644 1671 // wp_notify_postauthor() checks if notifying the author of their own comment. 1645 1672 // By default, it won't, but filters can override this. 1646 if ( get_option( 'comments_notify' ) && $commentdata['comment_approved']) {1673 if ( $maybe_notify ) { 1647 1674 wp_notify_postauthor( $comment_ID ); 1648 1675 } 1649 1676 } … … 1659 1686 * 1660 1687 * @since 1.0.0 1661 1688 * 1689 * @uses apply_filters() Calls 'wp_notify_post_author' to determine if post 1690 * author should be notified. 1691 * 1662 1692 * global wpdb $wpdb 1663 1693 * 1664 1694 * @param int $comment_id Comment ID. … … 1677 1707 case 'approve': 1678 1708 case '1': 1679 1709 $status = '1'; 1680 if ( get_option('comments_notify') ) { 1710 $maybe_notify = get_option( 'comments_notify' ); 1711 1712 /** This filter is documented in wp-includes/comment-functions.php */ 1713 $maybe_notify = apply_filters( 'wp_notify_post_author', $maybe_notify, $comment_id ); 1714 if ( $maybe_notify ) { 1681 1715 wp_notify_postauthor( $comment_id ); 1682 1716 } 1683 1717 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);