Make WordPress Core

Ticket #40477: 40477.patch

File 40477.patch, 682 bytes (added by mrahmadawais, 7 years ago)

ADD: Email Notifications on user creation by WP REST API

  • src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
    index 63fb4e9e99..772173b1f6 100644
    a b class WP_REST_Users_Controller extends WP_REST_Controller { 
    507507                } else {
    508508                        $user_id = wp_insert_user( wp_slash( (array) $user ) );
    509509
     510                        // Trigger admin and user notifications for the new user.
     511                        wp_new_user_notification( $user_id, null, 'both' );
     512
    510513                        if ( is_wp_error( $user_id ) ) {
    511514                                return $user_id;
    512515                        }