Make WordPress Core

Ticket #33587: 33587.3.diff

File 33587.3.diff, 3.7 KB (added by boonebgorges, 10 years ago)
  • src/wp-includes/comment-functions.php

    diff --git src/wp-includes/comment-functions.php src/wp-includes/comment-functions.php
    index f953a9e..76a7a16 100644
    function wp_new_comment( $commentdata ) { 
    16291629         */
    16301630        do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'] );
    16311631
    1632         if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching
    1633                 if ( '0' == $commentdata['comment_approved'] ) {
    1634                         wp_notify_moderator( $comment_ID );
    1635                 }
     1632        return $comment_ID;
     1633}
    16361634
    1637                 // wp_notify_postauthor() checks if notifying the author of their own comment.
    1638                 // By default, it won't, but filters can override this.
    1639                 if ( get_option( 'comments_notify' ) && $commentdata['comment_approved'] ) {
    1640                         wp_notify_postauthor( $comment_ID );
    1641                 }
     1635/**
     1636 * Initiate a comment moderation notification for the comment moderator.
     1637 *
     1638 * @since 4.4.0
     1639 *
     1640 * @param int $comment_ID       ID of the comment.
     1641 * @param int $comment_approved Whether the comment is approved.
     1642 */
     1643function wp_new_comment_moderator_notification( $comment_ID, $comment_approved ) {
     1644        if ( '0' == $comment_approved ) {
     1645                wp_notify_moderator( $comment_ID );
    16421646        }
     1647}
    16431648
    1644         return $comment_ID;
     1649/**
     1650 * Initiate a new comment notification for the post author.
     1651 *
     1652 * @since 4.4.0
     1653 *
     1654 * @param int $comment_ID       ID of the comment.
     1655 */
     1656function wp_new_comment_postauthor_notification( $comment_ID ) {
     1657        // wp_notify_postauthor() checks if notifying the author of their own comment.
     1658        // By default, it won't, but filters can override this.
     1659        if ( get_option( 'comments_notify' ) && $commentdata['comment_approved'] ) {
     1660                wp_notify_postauthor( $comment_ID );
     1661        }
    16451662}
    16461663
    16471664/**
  • src/wp-includes/default-filters.php

    diff --git src/wp-includes/default-filters.php src/wp-includes/default-filters.php
    index b6f0ce3..095e8e1 100644
    add_action( 'split_shared_term', '_wp_check_split_terms_in_menus', 10, 4 ); 
    334334add_action( 'split_shared_term', '_wp_check_split_nav_menu_terms', 10, 4 );
    335335add_action( 'wp_split_shared_term_batch', '_wp_batch_split_terms' );
    336336
     337// Email notifications.
     338add_action( 'comment_post', 'wp_new_comment_notify_moderator', 10, 2 );
     339add_action( 'comment_post', 'wp_new_comment_notify_postauthor', 10 );
     340add_action( 'after_password_reset', 'wp_password_change_notification' );
     341add_action( 'register_new_user', 'wp_new_user_notification', 10, 2 );
     342
    337343/**
    338344 * Filters formerly mixed into wp-includes
    339345 */
  • src/wp-includes/user-functions.php

    diff --git src/wp-includes/user-functions.php src/wp-includes/user-functions.php
    index 762e54e..ab405e5 100644
    function reset_password( $user, $new_pass ) { 
    19161916        wp_set_password( $new_pass, $user->ID );
    19171917        update_user_option( $user->ID, 'default_password_nag', false, true );
    19181918
    1919         wp_password_change_notification( $user );
     1919        /**
     1920         * Fires after the user's password is reset.
     1921         *
     1922         * @since 4.4.0
     1923         *
     1924         * @param object $user     The user.
     1925         * @param string $new_pass New user password.
     1926         */
     1927        do_action( 'after_password_reset', $user, $new_pass );
    19201928}
    19211929
    19221930/**
    function register_new_user( $user_login, $user_email ) { 
    20042012
    20052013        update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
    20062014
    2007         wp_new_user_notification( $user_id, 'both' );
     2015        /**
     2016         * Fires after a new user registration has been recorded.
     2017         *
     2018         * @since 4.4.0
     2019         *
     2020         * @param int $user_id ID of the newly registered user.
     2021         * @param string $notify 'both' is passed to the filter for the `wp_new_user_notification()` callback.
     2022         */
     2023        do_action( 'register_new_user', $user_id, 'both' );
    20082024
    20092025        return $user_id;
    20102026}