Skip to content

Commit

Permalink
Use WP 5.1-era hook
Browse files Browse the repository at this point in the history
  • Loading branch information
kraftbj committed May 2, 2019
1 parent a2cb104 commit 9fd39dd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions class.jetpack-network.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ private function __construct() {
/*
* If admin wants to automagically register new sites set the hook here
*
* This is a hacky way because xmlrpc is not available on wpmu_new_blog
* This is a hacky way because xmlrpc is not available on wp_initialize_site
*/
if ( $this->get_option( 'auto-connect' ) == 1 ) {
add_action( 'wpmu_new_blog', array( $this, 'do_automatically_add_new_site' ) );
add_action( 'wp_initialize_site', array( $this, 'do_automatically_add_new_site' ) );
}
}

Expand Down Expand Up @@ -107,12 +107,15 @@ public function set_auto_activated_modules( $modules ) {
* Registers new sites upon creation
*
* @since 2.9
* @uses wpmu_new_blog
* @since 7.4.0 Uses a WP_Site object.
* @uses wp_initialize_site
*
* @param int $blog_id
* @param WP_Site $site
**/
public function do_automatically_add_new_site( $blog_id ) {
$this->do_subsiteregister( $blog_id );
public function do_automatically_add_new_site( $site ) {
if ( is_a( $site, 'WP_Site') ) {
$this->do_subsiteregister( $site->id );
}
}

/**
Expand Down

0 comments on commit 9fd39dd

Please sign in to comment.