Make WordPress Core

Ticket #41757: ms-functions.diff

File ms-functions.diff, 1.1 KB (added by danieltj, 8 years ago)

Adds hook to new user function.

  • wp-includes/ms-functions.php

    diff --git wp-includes/ms-functions.php wp-includes/ms-functions.php
    index 7c28844e0c..bde4e6eb0f 100644
    function add_existing_user_to_blog( $details = false ) { 
    21362136 * @see add_user_to_blog()
    21372137 *
    21382138 * @param int   $user_id
    2139  * @param mixed $password Ignored.
     2139 * @param mixed $password Accessible via 'added_new_user_to_blog' hook.
    21402140 * @param array $meta
    21412141 */
    21422142function add_new_user_to_blog( $user_id, $password, $meta ) {
    function add_new_user_to_blog( $user_id, $password, $meta ) { 
    21492149
    21502150                if ( ! is_wp_error( $result ) ) {
    21512151                        update_user_meta( $user_id, 'primary_blog', $blog_id );
     2152
     2153                        /**
     2154                         * Fires when a new user is added to a network site without an error from $result.
     2155                         *
     2156                         * @since 4.9.0
     2157                         *
     2158                         * @param int    $user_id  New user's ID.
     2159                         * @param mixed  $password New user's password.
     2160                         * @param array  $meta     Array of meta data from the new registration.
     2161                         * @param int    $blog_id  Blog ID.
     2162                         */
     2163                        do_action( 'added_new_user_to_blog', $user_id, $password, $meta, $blog_id );
    21522164                }
    21532165        }
    21542166}