WordPress.org

Make WordPress Core

Ticket #33504: 33504.4.diff

File 33504.4.diff, 6.8 KB (added by tharsheblows, 5 years ago)

refresh patch and update other actions for consistency

  • wp-admin/includes/user.php

     
    181181                $user_id = wp_update_user( $user );
    182182        } else {
    183183                $user_id = wp_insert_user( $user );
     184                $notify = ( ! isset( $_POST['send_reset_link'] ) ) ? 'admin' : 'both';
     185
    184186                /**
    185187                  * Fires after a new user has been created.
    186188                  *
     
    187189                  * @since 4.4.0
    188190                  *
    189191                  * @param int $user_id ID of the newly created user.
     192                  * @param string $notify Email the user a password reset link. Defaults to 'both' which sends the email. To not send the email use $notify = 'admin'.
    190193                  */
    191                 do_action( 'edit_user_created_user', $user_id );
     194                do_action( 'edit_user_created_user', $user_id, $notify );
    192195        }
    193196        return $user_id;
    194197}
  • wp-admin/network/site-new.php

     
    101101                  * @since 4.4.0
    102102                  *
    103103                  * @param int $user_id ID of the newly created user.
     104                  * @param string $notify Email the user a password reset link. Defaults to 'both' which sends the email. To not send the email use $notify = 'admin'.
    104105                  */
    105                 do_action( 'network_site_new_created_user', $user_id );
     106                do_action( 'network_site_new_created_user', $user_id, $notify );
    106107        }
    107108
    108109        $wpdb->hide_errors();
  • wp-admin/network/site-users.php

     
    8585                                          * @since 4.4.0
    8686                                          *
    8787                                          * @param int $user_id ID of the newly created user.
     88                                          * @param string $notify Email the user a password reset link. Defaults to 'both' which sends the email. To not send the email use $notify = 'admin'.
    8889                                          */
    89                                         do_action( 'network_site_users_created_user', $user_id );
     90                                        do_action( 'network_site_users_created_user', $user_id, $notify );
    9091                                }
    9192                        }
    9293                        break;
  • wp-admin/network/user-new.php

     
    5757                          * @since 4.4.0
    5858                          *
    5959                          * @param int $user_id ID of the newly created user.
     60                          * @param int $notify Email the user a password reset link. Default is 'both' which sends the email. To not send the email use $notify = 'admin'.
    6061                          */
    61                         do_action( 'network_user_new_created_user', $user_id );
     62                        do_action( 'network_user_new_created_user', $user_id, $notify );
    6263                        wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) );
    6364                        exit;
    6465                }
  • wp-admin/user-new.php

     
    368368$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
    369369$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
    370370$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
    371 $new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : true;
     371$send_reset_link = $creating && ! isset( $_POST['send_reset_link'] ) ? false : true;
    372372$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
    373373
    374374?>
     
    436436                        </label>
    437437                </td>
    438438        </tr>
     439        <tr>
     440                <th scope="row"><label for="send_reset_link"><?php _e('') ?></label></th>
     441                <td>
     442                        <label for="send_reset_link">
     443                                <input type="checkbox" name="send_reset_link" id="send_reset_link" value="both" <?php checked( $send_reset_link ); ?> />
     444                                <?php _e('Send the new user a reset password link.'); ?>
     445                        </label>
     446                </td>
     447        </tr>
    439448<?php } // !is_multisite ?>
    440449        <tr class="form-field">
    441450                <th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
  • wp-includes/default-filters.php

     
    343343add_action( 'comment_post', 'wp_new_comment_notify_moderator' );
    344344add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
    345345add_action( 'after_password_reset', 'wp_password_change_notification' );
    346 add_action( 'register_new_user',      'wp_send_new_user_notifications' );
    347 add_action( 'edit_user_created_user', 'wp_send_new_user_notifications' );
     346add_action( 'register_new_user',      'wp_send_new_user_notifications', 10, 2 );
     347add_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );
    348348
    349349/**
    350350 * Filters formerly mixed into wp-includes
  • wp-includes/ms-default-filters.php

     
    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 );
    30 add_action( 'network_site_new_created_user',   'wp_send_new_user_notifications' );
    31 add_action( 'network_site_users_created_user', 'wp_send_new_user_notifications' );
    32 add_action( 'network_user_new_created_user',   'wp_send_new_user_notifications' );
     30add_action( 'network_site_new_created_user',   'wp_send_new_user_notifications', 10, 2 );
     31add_action( 'network_site_users_created_user', 'wp_send_new_user_notifications', 10, 2 );
     32add_action( 'network_user_new_created_user',   'wp_send_new_user_notifications', 10, 2 );
    3333add_filter( 'sanitize_user', 'strtolower' );
    3434
    3535// Blogs
  • wp-includes/user-functions.php

     
    20662066         * @since 4.4.0
    20672067         *
    20682068         * @param int $user_id ID of the newly registered user.
     2069         * @param string $notify Email the user a password reset link. Defaults to 'both' which sends the email. To not send the email use $notify = 'admin'.
    20692070         */
    2070         do_action( 'register_new_user', $user_id );
     2071        do_action( 'register_new_user', $user_id, $notify );
    20712072
    20722073        return $user_id;
    20732074}
     
    20812082 *
    20822083 * @param int $user_id ID of the newly created user.
    20832084 */
    2084 function wp_send_new_user_notifications( $user_id ) {
    2085         wp_new_user_notification( $user_id, null, 'both' );
     2085function wp_send_new_user_notifications( $user_id, $notify = 'both' ) {
     2086        wp_new_user_notification( $user_id, null, $notify );
    20862087}
    20872088
    20882089/**