Make WordPress Core

Ticket #25762: 25762.11.diff

File 25762.11.diff, 4.0 KB (added by Denis-de-Bernardy, 10 years ago)

Per IRC discussions

  • wp-admin/includes/upgrade.php

    diff --git wp-admin/includes/upgrade.php wp-admin/includes/upgrade.php
    index 5d2e3fc..3daf80e 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         *
    94102         * @param WP_User $user The site owner.
    if ( !function_exists('wp_install_defaults') ) : 
    112120function wp_install_defaults( $user_id ) {
    113121        global $wpdb, $wp_rewrite, $table_prefix;
    114122
     123        $user = new WP_User($user_id);
     124
    115125        // Default category
    116126        $cat_name = __('Uncategorized');
    117127        /* translators: Default category slug */
    As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d 
    239249                $wp_rewrite->init();
    240250                $wp_rewrite->flush_rules();
    241251
    242                 $user = new WP_User($user_id);
    243252                $wpdb->update( $wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email') );
    244253
    245254                // Remove all perms except for the login user.
    As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d 
    250259                if ( !is_super_admin( $user_id ) && $user_id != 1 )
    251260                        $wpdb->delete( $wpdb->usermeta, array( 'user_id' => $user_id , 'meta_key' => $wpdb->base_prefix.'1_capabilities' ) );
    252261        }
     262
     263        /**
     264         * Fires after a site's defaults are fully set.
     265         *
     266         * Note: this hook fires once when WP itself is being installed, and once per
     267         * additional site on multisite installations. In both cases, it is fired in
     268         * the context of the newly installed site.
     269         *
     270         * For multisite installations, see also the wpmu_new_blog hook, which is
     271         * fired at the very end of wpmu_create_blog() in the context of wherever
     272         * the new site got installed.
     273         *
     274         * Note 2: the user is marked as an administrator when the hook fires on a
     275         * single site install; this is not the case on a multisite install.
     276         *
     277         * @since 3.9.0
     278         *
     279         * @param WP_User $user The site owner.
     280         */
     281        do_action( 'wp_install_defaults', $user );
    253282}
    254283endif;
    255284
    if ( !function_exists('wp_new_blog_notification') ) : 
    268297 */
    269298function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
    270299        $user = new WP_User( $user_id );
    271         $email = $user->user_email;
    272300        $name = $user->user_login;
     301
     302        $subject = __( 'New WordPress Site' );
     303        $email = $user->user_email;
     304
    273305        $message = sprintf(__("Your new WordPress site has been successfully set up at:
    274306
    275307%1\$s
    We hope you enjoy your new site. Thanks! 
    285317http://wordpress.org/
    286318"), $blog_url, $name, $password);
    287319
    288         @wp_mail($email, __('New WordPress Site'), $message);
     320        /**
     321         * Fires before sending a new blog notification by email to that blog's admin.
     322         *
     323         * To override the email, or cancel it altogether, apply your custom logic
     324         * and return false.
     325         *
     326         * @since 3.9.0
     327         *
     328         * @param boolean $send return false to prevent WP from sending an email.
     329         * @param string $blog_url Blog url.
     330         * @param int $user_id User ID.
     331         * @param string $password User's Password.
     332         */
     333        if ( apply_filters( 'wp_new_blog_notification', true, $blog_title, $blog_url, $user_id, $password ) ) {
     334                WP_DEBUG ? wp_mail( $email, $subject, $message ) : @wp_mail( $email, $subject, $message );
     335        }
    289336}
    290337endif;
    291338
  • 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.