Make WordPress Core

Ticket #14170: 14170.3.diff

File 14170.3.diff, 1.5 KB (added by scribu, 14 years ago)

activation for new sites

  • wp-includes/ms-default-filters.php

     
    2222
    2323// Blogs
    2424add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
     25add_action( 'wpmu_new_blog', 'wpmu_activate_network_plugins', 9 );
    2526add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
    2627add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
    2728
  • wp-includes/ms-functions.php

     
    12241224        update_option( 'post_count', (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ) );
    12251225}
    12261226
     1227/**
     1228 * Fires activation hooks for all active network plugins
     1229 *
     1230 * @since 3.1.0
     1231 *
     1232 * @param int $blog_id Blog ID
     1233 */
     1234function wpmu_activate_network_plugins( $blog_id ) {
     1235        switch_to_blog( $blog_id );
     1236
     1237        $active_sitewide_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
     1238
     1239        foreach ( array_keys( $active_sitewide_plugins ) as $plugin ) {
     1240                do_action( 'activate_' . $plugin, false );
     1241                do_action( 'activate_plugin', $plugin, false );
     1242        }
     1243
     1244        restore_current_blog();
     1245}
     1246
    12271247function wpmu_log_new_registrations( $blog_id, $user_id ) {
    12281248        global $wpdb;
    12291249        $user = new WP_User( (int) $user_id );