Make WordPress Core

Ticket #33587: 33587.4.diff

File 33587.4.diff, 9.7 KB (added by thomaswm, 10 years ago)
  • wp-admin/includes/user.php

     
    176176                $user_id = wp_update_user( $user );
    177177        } else {
    178178                $user_id = wp_insert_user( $user );
    179                 wp_new_user_notification( $user_id, 'both' );
     179                /**
     180                  * Fires after a new user has been created.
     181                  *
     182                  * @since 4.4.0
     183                  *
     184                  * @param int $user_id ID of the newly created user.
     185                  * @param string $notify 'both' is passed to the filter for the `wp_new_user_notification()` callback.
     186                  */
     187                do_action( 'create_user', $user_id, 'both' );
    180188        }
    181189        return $user_id;
    182190}
  • wp-admin/network/site-new.php

     
    9494                if ( false === $user_id )
    9595                        wp_die( __( 'There was an error creating the user.' ) );
    9696                else
    97                         wp_new_user_notification( $user_id, 'both' );
     97                        /**
     98                          * Fires after a new user has been created.
     99                          *
     100                          * @since 4.4.0
     101                          *
     102                          * @param int $user_id ID of the newly created user.
     103                          * @param string $notify 'both' is passed to the filter for the `wp_new_user_notification()` callback.
     104                          */
     105                        do_action( 'create_user', $user_id, 'both' );
    98106        }
    99107
    100108        $wpdb->hide_errors();
  • wp-admin/network/site-users.php

     
    7777                                if ( false === $user_id ) {
    7878                                        $update = 'err_new_dup';
    7979                                } else {
    80                                         wp_new_user_notification( $user_id, 'both' );
    8180                                        add_user_to_blog( $id, $user_id, $_POST['new_role'] );
    8281                                        $update = 'newuser';
     82                                        /**
     83                                          * Fires after a new user has been created.
     84                                          *
     85                                          * @since 4.4.0
     86                                          *
     87                                          * @param int $user_id ID of the newly created user.
     88                                          * @param string $notify 'both' is passed to the filter for the `wp_new_user_notification()` callback.
     89                                          */
     90                                        do_action( 'create_user', $user_id, 'both' );
    8391                                }
    8492                        }
    8593                        break;
  • wp-admin/network/user-new.php

     
    5151                if ( ! $user_id ) {
    5252                        $add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) );
    5353                } else {
    54                         wp_new_user_notification( $user_id, 'both' );
     54                        /**
     55                          * Fires after a new user has been created.
     56                          *
     57                          * @since 4.4.0
     58                          *
     59                          * @param int $user_id ID of the newly created user.
     60                          * @param string $notify 'both' is passed to the filter for the `wp_new_user_notification()` callback.
     61                          */
     62                        do_action( 'create_user', $user_id, 'both' );
    5563                        wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) );
    5664                        exit;
    5765                }
  • wp-includes/comment-functions.php

     
    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/**
  • wp-includes/default-filters.php

     
    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 );
     342add_action( 'create_user', 'wp_new_user_notification', 10, 2 );
     343
    337344/**
    338345 * Filters formerly mixed into wp-includes
    339346 */
  • wp-includes/ms-default-filters.php

     
    2525add_action( 'init', 'maybe_add_existing_user_to_blog' );
    2626add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' );
    2727add_action( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
     28add_action( 'wpmu_activate_user', 'wpmu_welcome_user_notification', 10, 3 );
    2829add_filter( 'sanitize_user', 'strtolower' );
     30add_action( 'after_signup_user', 'wpmu_signup_user_notification', 10, 4 );
    2931
    3032// Blogs
    3133add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
    3234add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
    3335add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
     36add_action( 'wpmu_activate_blog', 'wpmu_welcome_notification', 10, 5 );
     37add_action( 'after_signup_blog', 'wpmu_signup_blog_notification', 10, 7 );
    3438
    3539// Register Nonce
    3640add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
  • wp-includes/ms-functions.php

     
    745745                'meta' => $meta
    746746        ) );
    747747
    748         wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta);
     748        /**
     749         * Fires after site signup information has been written to the database
     750         *
     751         * @since
     752         *
     753         * @param string $domain     The requested domain.
     754         * @param string $path       The requested path.
     755         * @param string $title      The requested site title.
     756         * @param string $user       The user's requested login name.
     757         * @param string $user_email The user's email address.
     758         * @param string $key        The user's activation key
     759         * @param array  $meta       By default, contains the requested privacy setting and lang_id.
     760         */
     761        do_action( 'after_signup_blog', $domain, $path, $title, $user, $user_email, $key, $meta );
    749762}
    750763
    751764/**
     
    782795                'meta' => $meta
    783796        ) );
    784797
    785         wpmu_signup_user_notification($user, $user_email, $key, $meta);
     798        /**
     799         * Fires after a user's signup information has been written to the database
     800         *
     801         * @since
     802         *
     803         * @param string $user       The user's requested login name.
     804         * @param string $user_email The user's email address.
     805         * @param string $key        The user's activation key
     806         * @param array  $meta       By default, this is an empty array.
     807         */
     808        do_action( 'after_signup_user', $user, $user_email, $key, $meta);
    786809}
    787810
    788811/**
     
    10271050                if ( isset( $user_already_exists ) )
    10281051                        return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
    10291052
    1030                 wpmu_welcome_user_notification( $user_id, $password, $meta );
    10311053                /**
    10321054                 * Fires immediately after a new user is activated.
    10331055                 *
     
    10551077        }
    10561078
    10571079        $wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
    1058         wpmu_welcome_notification($blog_id, $user_id, $password, $signup->title, $meta);
    10591080        /**
    10601081         * Fires immediately after a site is activated.
    10611082         *
  • wp-includes/user-functions.php

     
    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/**
     
    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}