Trigger activation hooks for netork plugins when new site is created. See #14170
git-svn-id: https://develop.svn.wordpress.org/trunk@16021 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
665b15790d
commit
9c918c6a05
@ -22,6 +22,7 @@ add_action( 'sanitize_user', 'strtolower' );
|
|||||||
|
|
||||||
// Blogs
|
// Blogs
|
||||||
add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
|
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', 'wpmu_log_new_registrations', 10, 2 );
|
||||||
add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 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'" ) );
|
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 ) {
|
function wpmu_log_new_registrations( $blog_id, $user_id ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$user = new WP_User( (int) $user_id );
|
$user = new WP_User( (int) $user_id );
|
||||||
|
Loading…
Reference in New Issue
Block a user