Make WordPress Core

Ticket #25762: 25762.8.diff

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

add wp_install_defaults hook, and switch to user_id for wp_install for consistency

  • wp-admin/includes/upgrade.php

    diff --git wp-admin/includes/upgrade.php wp-admin/includes/upgrade.php
    index 5d2e3fc..aa81d51 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
  • 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.