Make WordPress Core


Ignore:
Timestamp:
09/16/2015 10:18:33 PM (10 years ago)
Author:
boonebgorges
Message:

Move new user notification emails to add_action() callbacks.

When a new user is created in various places throughout the interface,
notifications are sent to the site admin and the new user. Previously, these
notifications were fired through direct calls to wp_new_user_notification(),
making it difficult to stop or modify the messages.

This changeset introduces a number of new action hooks in place of direct calls
to wp_new_user_notification(), and hooks the new wrapper function
wp_send_new_user_notifications() to these hooks.

Props dshanske, thomaswm, boonebgorges.
Fixes #33587.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user-functions.php

    r34218 r34251  
    20242024    update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
    20252025
     2026    /**
     2027     * Fires after a new user registration has been recorded.
     2028     *
     2029     * @since 4.4.0
     2030     *
     2031     * @param int $user_id ID of the newly registered user.
     2032     */
     2033    do_action( 'register_new_user', $user_id );
     2034
     2035    return $user_id;
     2036}
     2037
     2038/**
     2039 * Initiate email notifications related to the creation of new users.
     2040 *
     2041 * Notifications are sent both to the site admin and to the newly created user.
     2042 *
     2043 * @since 4.4.0
     2044 *
     2045 * @param int $user_id ID of the newly created user.
     2046 */
     2047function wp_send_new_user_notifications( $user_id ) {
    20262048    wp_new_user_notification( $user_id, null, 'both' );
    2027 
    2028     return $user_id;
    20292049}
    20302050
Note: See TracChangeset for help on using the changeset viewer.