Make WordPress Core

Ticket #25762: 25762.10.diff

File 25762.10.diff, 6.2 KB (added by Denis-de-Bernardy, 11 years ago)

Same as the previous one, s/4space/tab/

  • wp-admin/includes/upgrade.php

    diff --git wp-admin/includes/upgrade.php wp-admin/includes/upgrade.php
    index 5d2e3fc..36896a4 100644
    function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated 
    8989        /**
    9090         * Fires after a site is fully installed.
    9191         *
     92         * Note: this hook only ever fires once when WP itself is being installed.
     93         * It is never fired afterwards.
     94         *
     95         * To customize new sites on WP multisite installations, use either of:
     96         *
     97         * - wp_install_defaults
     98         * - wpmu_new_blog
     99         *
    92100         * @since 3.9.0
    93101         *
    94          * @param WP_User $user The site owner.
     102         * @param int $user_id The site owner's id.
    95103         */
    96         do_action( 'wp_install', $user );
     104        do_action( 'wp_install', $user_id );
    97105
    98106        return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
    99107}
    As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d 
    250258                if ( !is_super_admin( $user_id ) && $user_id != 1 )
    251259                        $wpdb->delete( $wpdb->usermeta, array( 'user_id' => $user_id , 'meta_key' => $wpdb->base_prefix.'1_capabilities' ) );
    252260        }
     261
     262        /**
     263         * Fires after a site's defaults are fully installed.
     264         *
     265         * Note: this hook fires once when WP itself is being installed, and once per
     266         * additional sites on multisite installations. In both cases, it is fired in
     267         * the context of the newly installed site.
     268         *
     269         * For multisite installations, see also the wpmu_new_blog hook, which is
     270         * fired at the very end of wpmu_create_blog() in the context of wherever
     271         * the new site got installed.
     272         *
     273         * Note 2: the user is marked as an administrator when the hook fires on a
     274         * single site install; this is not the case on a multisite install.
     275         *
     276         * @since 3.9.0
     277         *
     278         * @param int $user_id The site owner's id.
     279         */
     280        do_action( 'wp_install_defaults', $user_id );
    253281}
    254282endif;
    255283
    if ( !function_exists('wp_new_blog_notification') ) : 
    267295 * @param string $password User's Password.
    268296 */
    269297function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
     298        $context = compact('blog_title', 'blog_url', 'user_id', 'password');
     299
    270300        $user = new WP_User( $user_id );
    271         $email = $user->user_email;
    272301        $name = $user->user_login;
     302
     303        $subject = __('New WordPress Site');
     304        $email = $user->user_email;
     305
    273306        $message = sprintf(__("Your new WordPress site has been successfully set up at:
    274307
    275308%1\$s
    We hope you enjoy your new site. Thanks! 
    285318http://wordpress.org/
    286319"), $blog_url, $name, $password);
    287320
    288         @wp_mail($email, __('New WordPress Site'), $message);
     321        /**
     322         * Fires before sending a new blog notification by email to that blog's admin.
     323         *
     324         * To override the email, or cancel it altogether, apply your custom logic
     325         * and return false.
     326         *
     327         * @since 3.9.0
     328         *
     329         * @param boolean $send return false to prevent WP from sending an email
     330         * @param array $context the arguments passed to wp_new_blog_notification()
     331         */
     332        if (apply_filters('wp_new_blog_notification', true, $context)) {
     333                WP_DEBUG ? wp_mail($email, $subject, $message) : @wp_mail($email, $subject, $message);
     334        }
    289335}
    290336endif;
    291337
  • wp-includes/ms-functions.php

    diff --git wp-includes/ms-functions.php wp-includes/ms-functions.php
    index b7b4b6a..6474fa6 100644
    function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $s 
    11721172        /**
    11731173         * Fires immediately after a new site is created.
    11741174         *
     1175         * See also the wp_install_defaults hook, which fires before the current
     1176         * blog's context is restored.
     1177         *
    11751178         * @since MU
    11761179         *
    11771180         * @param int    $blog_id Blog ID.
  • wp-includes/pluggable.php

    diff --git wp-includes/pluggable.php wp-includes/pluggable.php
    index 794565f..c75dfa7 100644
    if ( !function_exists('wp_new_user_notification') ) : 
    12811281 * @param string $plaintext_pass Optional. The user's plaintext password
    12821282 */
    12831283function wp_new_user_notification($user_id, $plaintext_pass = '') {
     1284        $context = compact('user_id', 'plaintext_pass');
     1285
    12841286        $user = get_userdata( $user_id );
    12851287
    12861288        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    12871289        // we want to reverse this for the plain text arena of emails.
    12881290        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    12891291
     1292        $subject = sprintf(__('[%s] New User Registration', $blogname));
     1293        $email = get_option('admin_email');
     1294
    12901295        $message  = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
    12911296        $message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
    12921297        $message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n";
    12931298
    1294         @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
     1299        /**
     1300         * Fires before sending a new user notification by email to that blog's admin.
     1301         *
     1302         * To override the email, or cancel it altogether, apply your custom logic
     1303         * and return false.
     1304         *
     1305         * @since 3.9.0
     1306         *
     1307         * @param boolean $send return false to prevent WP from sending an email
     1308         * @param array $context the arguments passed to wp_new_user_notification()
     1309         */
     1310        if (apply_filters('wp_new_user_notification_admin', true, $context)) {
     1311                WP_DEBUG ? wp_mail($email, $subject, $message) : @wp_mail($email, $subject, $message);
     1312        }
    12951313
    12961314        if ( empty($plaintext_pass) )
    12971315                return;
    12981316
     1317        $subject = sprintf(__('[%s] Your username and password'), $blogname);
     1318        $email = $user->user_email;
     1319
    12991320        $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
    13001321        $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
    13011322        $message .= wp_login_url() . "\r\n";
    13021323
    1303         wp_mail($user->user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
    1304 
     1324        /**
     1325         * Fires before sending a new user notification by email to that new user.
     1326         *
     1327         * To override the email, or cancel it altogether, apply your custom logic
     1328         * and return false.
     1329         *
     1330         * @since 3.9.0
     1331         *
     1332         * @param boolean $send return false to prevent WP from sending an email
     1333         * @param array $context the arguments passed to wp_new_user_notification()
     1334         */
     1335        if (apply_filters('wp_new_user_notification_user', true, $context)) {
     1336                WP_DEBUG ? wp_mail($email, $subject, $message) : @wp_mail($email, $subject, $message);
     1337        }
    13051338}
    13061339endif;
    13071340