mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Merge remote-tracking branch 'remotes/origin/multisite_create_new_blog'
This commit is contained in:
+19
-1
@@ -556,6 +556,12 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->mobile();
|
||||
$this->external_integrations();
|
||||
$this->gdpr();
|
||||
|
||||
//if multisite networks active
|
||||
if ( is_multisite() ) {
|
||||
$this->multisite();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1405,6 +1411,19 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
return $this->classes['mobile'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.0.44
|
||||
*
|
||||
* @return um\lib\mobiledetect\Um_Mobile_Detect
|
||||
*/
|
||||
function multisite() {
|
||||
|
||||
if ( empty( $this->classes['multisite'] ) ) {
|
||||
$this->classes['multisite'] = new um\core\Multisite();
|
||||
}
|
||||
|
||||
return $this->classes['multisite'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Include files with hooked filters/actions
|
||||
@@ -1453,7 +1472,6 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
function widgets_init() {
|
||||
register_widget( 'um\widgets\UM_Search_Widget' );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace um\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
if ( ! class_exists( 'um\core\Multisite' ) ) {
|
||||
|
||||
/**
|
||||
* Class Multisite
|
||||
* @package um\core
|
||||
*/
|
||||
class Multisite {
|
||||
|
||||
/**
|
||||
* Multisite constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
add_action( 'wpmu_new_blog', array( &$this, 'create_new_blog_old_wp' ) );
|
||||
add_action( 'wp_insert_site', array( &$this, 'create_new_blog' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $blog_id
|
||||
*/
|
||||
function create_new_blog_old_wp ( $blog_id ) {
|
||||
|
||||
switch_to_blog( $blog_id );
|
||||
UM()->single_site_activation();
|
||||
restore_current_blog();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $blog
|
||||
*/
|
||||
function create_new_blog ( $blog ) {
|
||||
|
||||
switch_to_blog( $blog->blog_id );
|
||||
UM()->single_site_activation();
|
||||
restore_current_blog();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user