Make WordPress Core

Ticket #40477: 40477.3.patch

File 40477.3.patch, 800 bytes (added by mrahmadawais, 8 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..256277e610 100644
    a b class WP_REST_Users_Controller extends WP_REST_Controller { 
    510510                        if ( is_wp_error( $user_id ) ) {
    511511                                return $user_id;
    512512                        }
     513
     514                        /*
     515                         * Trigger default welcome email notifications.
     516                         *
     517                         * This action hook is documented in wp-admin/includes/user.php
     518                         *
     519                         * Add second param $notify to override the behavior.
     520                         */
     521                        do_action( 'edit_user_created_user', $user_id );
    513522                }
    514523
    515524                $user = get_user_by( 'id', $user_id );