diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php index e855e2e17d..3d37bdf579 100644 --- a/src/wp-admin/includes/user.php +++ b/src/wp-admin/includes/user.php @@ -176,14 +176,18 @@ function edit_user( $user_id = 0 ) { $user_id = wp_update_user( $user ); } else { $user_id = wp_insert_user( $user ); + $notify = isset( $_POST['send_user_notification'] ) ? 'both' : 'admin'; + /** * Fires after a new user has been created. * * @since 4.4.0 * - * @param int $user_id ID of the newly created user. + * @param int $user_id ID of the newly created user. + * @param string $notify Type of notification that should happen. See {@see wp_send_new_user_notifications()} + * for more information on possible values. */ - do_action( 'edit_user_created_user', $user_id ); + do_action( 'edit_user_created_user', $user_id, $notify ); } return $user_id; } diff --git a/src/wp-admin/user-new.php b/src/wp-admin/user-new.php index 0f16b28b2a..ff0bffb840 100644 --- a/src/wp-admin/user-new.php +++ b/src/wp-admin/user-new.php @@ -368,7 +368,7 @@ $new_user_lastname = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_P $new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : ''; $new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : ''; $new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : ''; -$new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : true; +$new_user_send_notification = $creating && ! isset( $_POST['send_user_notification'] ) ? false : true; $new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : ''; ?> @@ -418,7 +418,6 @@ $new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unsl
-+