Make WordPress Core

Ticket #33587: 33587.5.diff

File 33587.5.diff, 5.7 KB (added by boonebgorges, 9 years ago)
  • src/wp-admin/includes/user.php

    diff --git src/wp-admin/includes/user.php src/wp-admin/includes/user.php
    index 5c12d3d..906f5ca 100644
    function edit_user( $user_id = 0 ) { 
    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                  */
     186                do_action( 'edit_user_created_user', $user_id );
    180187        }
    181188        return $user_id;
    182189}
    this email. This invitation will expire in a few days. 
    503510
    504511Please click the following link to activate your user account:
    505512%%s' ), get_bloginfo( 'name' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ) );
    506 }
    507  No newline at end of file
     513}
  • src/wp-admin/network/site-new.php

    diff --git src/wp-admin/network/site-new.php src/wp-admin/network/site-new.php
    index c5fa157..18088b7 100644
    if ( wp_validate_action( 'add-site' ) ) { 
    9191        if ( !$user_id ) { // Create a new user with a random password
    9292                $password = wp_generate_password( 12, false );
    9393                $user_id = wpmu_create_user( $domain, $password, $email );
    94                 if ( false === $user_id )
     94                if ( false === $user_id ) {
    9595                        wp_die( __( 'There was an error creating the user.' ) );
    96                 else
    97                         wp_new_user_notification( $user_id, 'both' );
     96                }
     97
     98                /**
     99                  * Fires after a new user has been created via the network site-new.php page.
     100                  *
     101                  * @since 4.4.0
     102                  *
     103                  * @param int $user_id ID of the newly created user.
     104                  */
     105                do_action( 'network_site_new_created_user', $user_id );
    98106        }
    99107
    100108        $wpdb->hide_errors();
  • src/wp-admin/network/site-users.php

    diff --git src/wp-admin/network/site-users.php src/wp-admin/network/site-users.php
    index eb692f5..d27c79e 100644
    if ( $action ) { 
    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 user has been created via the network site-users.php page.
     84                                          *
     85                                          * @since 4.4.0
     86                                          *
     87                                          * @param int $user_id ID of the newly created user.
     88                                          */
     89                                        do_action( 'network_site_users_created_user', $user_id );
    8390                                }
    8491                        }
    8592                        break;
  • src/wp-admin/network/user-new.php

    diff --git src/wp-admin/network/user-new.php src/wp-admin/network/user-new.php
    index f2ccbb8..e0bdbe5 100644
    if ( wp_validate_action( 'add-user' ) ) { 
    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                          */
     61                        do_action( 'network_user_new_created_user', $user_id );
    5562                        wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) );
    5663                        exit;
    5764                }
  • src/wp-includes/default-filters.php

    diff --git src/wp-includes/default-filters.php src/wp-includes/default-filters.php
    index 3d3c2f0..e7303a9 100644
    add_action( 'wp_split_shared_term_batch', '_wp_batch_split_terms' ); 
    338338add_action( 'comment_post', 'wp_new_comment_notify_moderator', 10, 2 );
    339339add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
    340340add_action( 'after_password_reset', 'wp_password_change_notification' );
     341add_action( 'register_new_user',      'wp_send_new_user_notifications' );
     342add_action( 'edit_user_created_user', 'wp_send_new_user_notifications' );
    341343
    342344/**
    343345 * Filters formerly mixed into wp-includes
  • src/wp-includes/ms-default-filters.php

    diff --git src/wp-includes/ms-default-filters.php src/wp-includes/ms-default-filters.php
    index eab4fc4..08d752a 100644
    add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' ); 
    2727add_action( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
    2828add_action( 'wpmu_activate_user', 'wpmu_welcome_user_notification', 10, 3 );
    2929add_action( 'after_signup_user', 'wpmu_signup_user_notification', 10, 4 );
     30add_action( 'network_site_new_created_user',   'wp_send_new_user_notifications' );
     31add_action( 'network_site_users_created_user', 'wp_send_new_user_notifications' );
     32add_action( 'network_user_new_created_user',   'wp_send_new_user_notifications' );
    3033add_filter( 'sanitize_user', 'strtolower' );
    3134
    3235// Blogs
  • src/wp-includes/user-functions.php

    diff --git src/wp-includes/user-functions.php src/wp-includes/user-functions.php
    index 1feac3b..3640ea9 100644
    function register_new_user( $user_login, $user_email ) { 
    20122012
    20132013        update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
    20142014
    2015         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         */
     2022        do_action( 'register_new_user', $user_id );
    20162023
    20172024        return $user_id;
    20182025}
    20192026
    20202027/**
     2028 * Initiate email notifications related to the creation of new users.
     2029 *
     2030 * Notifications are sent both to the site admin and to the newly created user.
     2031 *
     2032 * @since 4.4.0
     2033 *
     2034 * @param int $user_id ID of the newly created user.
     2035 */
     2036function wp_send_new_user_notifications( $user_id ) {
     2037        wp_new_user_notification( $user_id, 'both' );
     2038}
     2039
     2040/**
    20212041 * Retrieve the current session token from the logged_in cookie.
    20222042 *
    20232043 * @since 4.0.0