Trigger activation hooks for netork plugins when new site is created. See #14170
git-svn-id: http://svn.automattic.com/wordpress/trunk@16021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8333876a68
commit
4eb0f634b2
|
@ -22,6 +22,7 @@ add_action( 'sanitize_user', 'strtolower' );
|
|||
|
||||
// Blogs
|
||||
add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
|
||||
add_action( 'wpmu_new_blog', 'wpmu_activate_network_plugins', 9 );
|
||||
add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
|
||||
add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
|
||||
|
||||
|
|
|
@ -1224,6 +1224,26 @@ function update_posts_count( $deprecated = '' ) {
|
|||
update_option( 'post_count', (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires activation hooks for all active network plugins
|
||||
*
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param int $blog_id Blog ID
|
||||
*/
|
||||
function wpmu_activate_network_plugins( $blog_id ) {
|
||||
switch_to_blog( $blog_id );
|
||||
|
||||
$active_sitewide_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
|
||||
|
||||
foreach ( array_keys( $active_sitewide_plugins ) as $plugin ) {
|
||||
do_action( 'activate_' . $plugin, false );
|
||||
do_action( 'activate_plugin', $plugin, false );
|
||||
}
|
||||
|
||||
restore_current_blog();
|
||||
}
|
||||
|
||||
function wpmu_log_new_registrations( $blog_id, $user_id ) {
|
||||
global $wpdb;
|
||||
$user = new WP_User( (int) $user_id );
|
||||
|
|
Loading…
Reference in New Issue