Skip to content

Commit 3f78a3d

Browse files
committed
#207 Installation not run on newly created subsite
@polevaultweb Resolves #207
1 parent 5f3fd3e commit 3f78a3d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

includes/actions.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,20 @@ function wpum_register_profile_privacy_fields() {
371371
) );
372372
}
373373
add_action( 'carbon_fields_register_fields', 'wpum_register_profile_privacy_fields' );
374+
375+
/**
376+
* Install default data when new site is added.
377+
* @param object $site
378+
* @return void
379+
*/
380+
function wpum_multisite_new_site( $site ){
381+
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
382+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
383+
}
384+
if ( is_plugin_active_for_network( 'wp-user-manager/wp-user-manager.php' ) ) {
385+
switch_to_blog( $site->blog_id );
386+
wpum_run_install();
387+
restore_current_blog();
388+
}
389+
}
390+
add_action( 'wp_initialize_site', 'wpum_multisite_new_site' );

0 commit comments

Comments
 (0)