wp/wp-includes/ms-functions.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    69 			update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
    69 			update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
    70 			$primary = $first_blog;
    70 			$primary = $first_blog;
    71 		}
    71 		}
    72 	}
    72 	}
    73 
    73 
    74 	if ( ( ! is_object( $primary ) ) || ( 1 == $primary->archived || 1 == $primary->spam || 1 == $primary->deleted ) ) {
    74 	if ( ( ! is_object( $primary ) )
       
    75 		|| ( '1' === $primary->archived || '1' === $primary->spam || '1' === $primary->deleted )
       
    76 	) {
    75 		$blogs = get_blogs_of_user( $user_id, true ); // If a user's primary blog is shut down, check their other blogs.
    77 		$blogs = get_blogs_of_user( $user_id, true ); // If a user's primary blog is shut down, check their other blogs.
    76 		$ret   = false;
    78 		$ret   = false;
       
    79 
    77 		if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
    80 		if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
       
    81 			$current_network_id = get_current_network_id();
       
    82 
    78 			foreach ( (array) $blogs as $blog_id => $blog ) {
    83 			foreach ( (array) $blogs as $blog_id => $blog ) {
    79 				if ( get_current_network_id() != $blog->site_id ) {
    84 				if ( $blog->site_id !== $current_network_id ) {
    80 					continue;
    85 					continue;
    81 				}
    86 				}
       
    87 
    82 				$details = get_site( $blog_id );
    88 				$details = get_site( $blog_id );
    83 				if ( is_object( $details ) && 0 == $details->archived && 0 == $details->spam && 0 == $details->deleted ) {
    89 				if ( is_object( $details )
       
    90 					&& '0' === $details->archived && '0' === $details->spam && '0' === $details->deleted
       
    91 				) {
    84 					$ret = $details;
    92 					$ret = $details;
    85 					if ( get_user_meta( $user_id, 'primary_blog', true ) != $blog_id ) {
    93 					if ( (int) get_user_meta( $user_id, 'primary_blog', true ) !== $blog_id ) {
    86 						update_user_meta( $user_id, 'primary_blog', $blog_id );
    94 						update_user_meta( $user_id, 'primary_blog', $blog_id );
    87 					}
    95 					}
    88 					if ( ! get_user_meta( $user_id, 'source_domain', true ) ) {
    96 					if ( ! get_user_meta( $user_id, 'source_domain', true ) ) {
    89 						update_user_meta( $user_id, 'source_domain', $details->domain );
    97 						update_user_meta( $user_id, 'source_domain', $details->domain );
    90 					}
    98 					}
    92 				}
   100 				}
    93 			}
   101 			}
    94 		} else {
   102 		} else {
    95 			return;
   103 			return;
    96 		}
   104 		}
       
   105 
    97 		return $ret;
   106 		return $ret;
    98 	} else {
   107 	} else {
    99 		return $primary;
   108 		return $primary;
   100 	}
   109 	}
   101 }
   110 }
   228  * @return true|WP_Error True on success or a WP_Error object if the user doesn't exist.
   237  * @return true|WP_Error True on success or a WP_Error object if the user doesn't exist.
   229  */
   238  */
   230 function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
   239 function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
   231 	global $wpdb;
   240 	global $wpdb;
   232 
   241 
       
   242 	$user_id = (int) $user_id;
       
   243 	$blog_id = (int) $blog_id;
       
   244 
   233 	switch_to_blog( $blog_id );
   245 	switch_to_blog( $blog_id );
   234 	$user_id = (int) $user_id;
       
   235 
   246 
   236 	/**
   247 	/**
   237 	 * Fires before a user is removed from a site.
   248 	 * Fires before a user is removed from a site.
   238 	 *
   249 	 *
   239 	 * @since MU (3.0.0)
   250 	 * @since MU (3.0.0)
   247 
   258 
   248 	/*
   259 	/*
   249 	 * If being removed from the primary blog, set a new primary
   260 	 * If being removed from the primary blog, set a new primary
   250 	 * if the user is assigned to multiple blogs.
   261 	 * if the user is assigned to multiple blogs.
   251 	 */
   262 	 */
   252 	$primary_blog = get_user_meta( $user_id, 'primary_blog', true );
   263 	$primary_blog = (int) get_user_meta( $user_id, 'primary_blog', true );
   253 	if ( $primary_blog == $blog_id ) {
   264 	if ( $primary_blog === $blog_id ) {
   254 		$new_id     = '';
   265 		$new_id     = '';
   255 		$new_domain = '';
   266 		$new_domain = '';
   256 		$blogs      = get_blogs_of_user( $user_id );
   267 		$blogs      = get_blogs_of_user( $user_id );
   257 		foreach ( (array) $blogs as $blog ) {
   268 		foreach ( (array) $blogs as $blog ) {
   258 			if ( $blog->userblog_id == $blog_id ) {
   269 			if ( $blog->userblog_id === $blog_id ) {
   259 				continue;
   270 				continue;
   260 			}
   271 			}
   261 			$new_id     = $blog->userblog_id;
   272 			$new_id     = $blog->userblog_id;
   262 			$new_domain = $blog->domain;
   273 			$new_domain = $blog->domain;
   263 			break;
   274 			break;
   339 function get_blog_id_from_url( $domain, $path = '/' ) {
   350 function get_blog_id_from_url( $domain, $path = '/' ) {
   340 	$domain = strtolower( $domain );
   351 	$domain = strtolower( $domain );
   341 	$path   = strtolower( $path );
   352 	$path   = strtolower( $path );
   342 	$id     = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
   353 	$id     = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
   343 
   354 
   344 	if ( -1 == $id ) { // Blog does not exist.
   355 	if ( -1 === $id ) { // Blog does not exist.
   345 		return 0;
   356 		return 0;
   346 	} elseif ( $id ) {
   357 	} elseif ( $id ) {
   347 		return (int) $id;
   358 		return (int) $id;
   348 	}
   359 	}
   349 
   360 
   460 	$errors = new WP_Error();
   471 	$errors = new WP_Error();
   461 
   472 
   462 	$orig_username = $user_name;
   473 	$orig_username = $user_name;
   463 	$user_name     = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
   474 	$user_name     = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
   464 
   475 
   465 	if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {
   476 	if ( $user_name !== $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {
   466 		$errors->add( 'user_name', __( 'Usernames can only contain lowercase letters (a-z) and numbers.' ) );
   477 		$errors->add( 'user_name', __( 'Usernames can only contain lowercase letters (a-z) and numbers.' ) );
   467 		$user_name = $orig_username;
   478 		$user_name = $orig_username;
   468 	}
   479 	}
   469 
   480 
   470 	$user_email = sanitize_email( $user_email );
   481 	$user_email = sanitize_email( $user_email );
   472 	if ( empty( $user_name ) ) {
   483 	if ( empty( $user_name ) ) {
   473 		$errors->add( 'user_name', __( 'Please enter a username.' ) );
   484 		$errors->add( 'user_name', __( 'Please enter a username.' ) );
   474 	}
   485 	}
   475 
   486 
   476 	$illegal_names = get_site_option( 'illegal_names' );
   487 	$illegal_names = get_site_option( 'illegal_names' );
       
   488 
   477 	if ( ! is_array( $illegal_names ) ) {
   489 	if ( ! is_array( $illegal_names ) ) {
   478 		$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
   490 		$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
   479 		add_site_option( 'illegal_names', $illegal_names );
   491 		add_site_option( 'illegal_names', $illegal_names );
   480 	}
   492 	}
       
   493 
   481 	if ( in_array( $user_name, $illegal_names, true ) ) {
   494 	if ( in_array( $user_name, $illegal_names, true ) ) {
   482 		$errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) );
   495 		$errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) );
   483 	}
   496 	}
   484 
   497 
   485 	/** This filter is documented in wp-includes/user.php */
   498 	/** This filter is documented in wp-includes/user.php */
   507 	if ( preg_match( '/^[0-9]*$/', $user_name ) ) {
   520 	if ( preg_match( '/^[0-9]*$/', $user_name ) ) {
   508 		$errors->add( 'user_name', __( 'Sorry, usernames must have letters too!' ) );
   521 		$errors->add( 'user_name', __( 'Sorry, usernames must have letters too!' ) );
   509 	}
   522 	}
   510 
   523 
   511 	$limited_email_domains = get_site_option( 'limited_email_domains' );
   524 	$limited_email_domains = get_site_option( 'limited_email_domains' );
       
   525 
   512 	if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
   526 	if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
   513 		$limited_email_domains = array_map( 'strtolower', $limited_email_domains );
   527 		$limited_email_domains = array_map( 'strtolower', $limited_email_domains );
   514 		$emaildomain           = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
   528 		$email_domain          = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
   515 		if ( ! in_array( $emaildomain, $limited_email_domains, true ) ) {
   529 
       
   530 		if ( ! in_array( $email_domain, $limited_email_domains, true ) ) {
   516 			$errors->add( 'user_email', __( 'Sorry, that email address is not allowed!' ) );
   531 			$errors->add( 'user_email', __( 'Sorry, that email address is not allowed!' ) );
   517 		}
   532 		}
   518 	}
   533 	}
   519 
   534 
   520 	// Check if the username has been used already.
   535 	// Check if the username has been used already.
   628 
   643 
   629 	$blog_title = strip_tags( $blog_title );
   644 	$blog_title = strip_tags( $blog_title );
   630 
   645 
   631 	$errors        = new WP_Error();
   646 	$errors        = new WP_Error();
   632 	$illegal_names = get_site_option( 'illegal_names' );
   647 	$illegal_names = get_site_option( 'illegal_names' );
   633 	if ( false == $illegal_names ) {
   648 
       
   649 	if ( ! is_array( $illegal_names ) ) {
   634 		$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
   650 		$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
   635 		add_site_option( 'illegal_names', $illegal_names );
   651 		add_site_option( 'illegal_names', $illegal_names );
   636 	}
   652 	}
   637 
   653 
   638 	/*
   654 	/*
   712 	/*
   728 	/*
   713 	 * Do not allow users to create a site that matches an existing user's login name,
   729 	 * Do not allow users to create a site that matches an existing user's login name,
   714 	 * unless it's the user's own username.
   730 	 * unless it's the user's own username.
   715 	 */
   731 	 */
   716 	if ( username_exists( $blogname ) ) {
   732 	if ( username_exists( $blogname ) ) {
   717 		if ( ! is_object( $user ) || ( is_object( $user ) && ( $user->user_login != $blogname ) ) ) {
   733 		if ( ! is_object( $user ) || ( is_object( $user ) && $user->user_login !== $blogname ) ) {
   718 			$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
   734 			$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
   719 		}
   735 		}
   720 	}
   736 	}
   721 
   737 
   722 	/*
   738 	/*
   920  * @param string $user_email The user's email address.
   936  * @param string $user_email The user's email address.
   921  * @param string $key        The activation key created in wpmu_signup_blog().
   937  * @param string $key        The activation key created in wpmu_signup_blog().
   922  * @param array  $meta       Optional. Signup meta data. By default, contains the requested privacy setting and lang_id.
   938  * @param array  $meta       Optional. Signup meta data. By default, contains the requested privacy setting and lang_id.
   923  * @return bool
   939  * @return bool
   924  */
   940  */
   925 function wpmu_signup_blog_notification( $domain, $path, $title, $user_login, $user_email, $key, $meta = array() ) {
   941 function wpmu_signup_blog_notification(
       
   942 	$domain,
       
   943 	$path,
       
   944 	$title,
       
   945 	$user_login,
       
   946 	$user_email,
       
   947 	#[\SensitiveParameter]
       
   948 	$key,
       
   949 	$meta = array()
       
   950 ) {
   926 	/**
   951 	/**
   927 	 * Filters whether to bypass the new site email notification.
   952 	 * Filters whether to bypass the new site email notification.
   928 	 *
   953 	 *
   929 	 * @since MU (3.0.0)
   954 	 * @since MU (3.0.0)
   930 	 *
   955 	 *
   939 	if ( ! apply_filters( 'wpmu_signup_blog_notification', $domain, $path, $title, $user_login, $user_email, $key, $meta ) ) {
   964 	if ( ! apply_filters( 'wpmu_signup_blog_notification', $domain, $path, $title, $user_login, $user_email, $key, $meta ) ) {
   940 		return false;
   965 		return false;
   941 	}
   966 	}
   942 
   967 
   943 	// Send email with activation link.
   968 	// Send email with activation link.
   944 	if ( ! is_subdomain_install() || get_current_network_id() != 1 ) {
   969 	if ( ! is_subdomain_install() || get_current_network_id() !== 1 ) {
   945 		$activate_url = network_site_url( "wp-activate.php?key=$key" );
   970 		$activate_url = network_site_url( "wp-activate.php?key=$key" );
   946 	} else {
   971 	} else {
   947 		$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo Use *_url() API.
   972 		$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo Use *_url() API.
   948 	}
   973 	}
   949 
   974 
  1055  * @param string $user_email The user's email address.
  1080  * @param string $user_email The user's email address.
  1056  * @param string $key        The activation key created in wpmu_signup_user()
  1081  * @param string $key        The activation key created in wpmu_signup_user()
  1057  * @param array  $meta       Optional. Signup meta data. Default empty array.
  1082  * @param array  $meta       Optional. Signup meta data. Default empty array.
  1058  * @return bool
  1083  * @return bool
  1059  */
  1084  */
  1060 function wpmu_signup_user_notification( $user_login, $user_email, $key, $meta = array() ) {
  1085 function wpmu_signup_user_notification(
       
  1086 	$user_login,
       
  1087 	$user_email,
       
  1088 	#[\SensitiveParameter]
       
  1089 	$key,
       
  1090 	$meta = array()
       
  1091 ) {
  1061 	/**
  1092 	/**
  1062 	 * Filters whether to bypass the email notification for new user sign-up.
  1093 	 * Filters whether to bypass the email notification for new user sign-up.
  1063 	 *
  1094 	 *
  1064 	 * @since MU (3.0.0)
  1095 	 * @since MU (3.0.0)
  1065 	 *
  1096 	 *
  1157  * @global wpdb $wpdb WordPress database abstraction object.
  1188  * @global wpdb $wpdb WordPress database abstraction object.
  1158  *
  1189  *
  1159  * @param string $key The activation key provided to the user.
  1190  * @param string $key The activation key provided to the user.
  1160  * @return array|WP_Error An array containing information about the activated user and/or blog.
  1191  * @return array|WP_Error An array containing information about the activated user and/or blog.
  1161  */
  1192  */
  1162 function wpmu_activate_signup( $key ) {
  1193 function wpmu_activate_signup(
       
  1194 	#[\SensitiveParameter]
       
  1195 	$key
       
  1196 ) {
  1163 	global $wpdb;
  1197 	global $wpdb;
  1164 
  1198 
  1165 	$signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key ) );
  1199 	$signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key ) );
  1166 
  1200 
  1167 	if ( empty( $signup ) ) {
  1201 	if ( empty( $signup ) ) {
  1309  * @param string $user_name The new user's login name.
  1343  * @param string $user_name The new user's login name.
  1310  * @param string $password  The new user's password.
  1344  * @param string $password  The new user's password.
  1311  * @param string $email     The new user's email address.
  1345  * @param string $email     The new user's email address.
  1312  * @return int|false Returns false on failure, or int $user_id on success.
  1346  * @return int|false Returns false on failure, or int $user_id on success.
  1313  */
  1347  */
  1314 function wpmu_create_user( $user_name, $password, $email ) {
  1348 function wpmu_create_user(
       
  1349 	$user_name,
       
  1350 	#[\SensitiveParameter]
       
  1351 	$password,
       
  1352 	$email
       
  1353 ) {
  1315 	$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
  1354 	$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
  1316 
  1355 
  1317 	$user_id = wp_create_user( $user_name, $password, $email );
  1356 	$user_id = wp_create_user( $user_name, $password, $email );
  1318 	if ( is_wp_error( $user_id ) ) {
  1357 	if ( is_wp_error( $user_id ) ) {
  1319 		return false;
  1358 		return false;
  1431 		return false;
  1470 		return false;
  1432 	}
  1471 	}
  1433 
  1472 
  1434 	$email = get_site_option( 'admin_email' );
  1473 	$email = get_site_option( 'admin_email' );
  1435 
  1474 
  1436 	if ( is_email( $email ) == false ) {
  1475 	if ( ! is_email( $email ) ) {
  1437 		return false;
  1476 		return false;
  1438 	}
  1477 	}
  1439 
  1478 
  1440 	$options_site_url = esc_url( network_admin_url( 'settings.php' ) );
  1479 	$options_site_url = esc_url( network_admin_url( 'settings.php' ) );
  1441 
  1480 
  1492 		return false;
  1531 		return false;
  1493 	}
  1532 	}
  1494 
  1533 
  1495 	$email = get_site_option( 'admin_email' );
  1534 	$email = get_site_option( 'admin_email' );
  1496 
  1535 
  1497 	if ( is_email( $email ) == false ) {
  1536 	if ( ! is_email( $email ) ) {
  1498 		return false;
  1537 		return false;
  1499 	}
  1538 	}
  1500 
  1539 
  1501 	$user = get_userdata( $user_id );
  1540 	$user = get_userdata( $user_id );
  1502 
  1541 
  1593  * @param string $password User password, or "N/A" if the user account is not new.
  1632  * @param string $password User password, or "N/A" if the user account is not new.
  1594  * @param string $title    Site title.
  1633  * @param string $title    Site title.
  1595  * @param array  $meta     Optional. Signup meta data. By default, contains the requested privacy setting and lang_id.
  1634  * @param array  $meta     Optional. Signup meta data. By default, contains the requested privacy setting and lang_id.
  1596  * @return bool Whether the email notification was sent.
  1635  * @return bool Whether the email notification was sent.
  1597  */
  1636  */
  1598 function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = array() ) {
  1637 function wpmu_welcome_notification(
       
  1638 	$blog_id,
       
  1639 	$user_id,
       
  1640 	#[\SensitiveParameter]
       
  1641 	$password,
       
  1642 	$title,
       
  1643 	$meta = array()
       
  1644 ) {
  1599 	$current_network = get_network();
  1645 	$current_network = get_network();
  1600 
  1646 
  1601 	/**
  1647 	/**
  1602 	 * Filters whether to bypass the welcome email sent to the site administrator after site activation.
  1648 	 * Filters whether to bypass the welcome email sent to the site administrator after site activation.
  1603 	 *
  1649 	 *
  1618 	$user = get_userdata( $user_id );
  1664 	$user = get_userdata( $user_id );
  1619 
  1665 
  1620 	$switched_locale = switch_to_user_locale( $user_id );
  1666 	$switched_locale = switch_to_user_locale( $user_id );
  1621 
  1667 
  1622 	$welcome_email = get_site_option( 'welcome_email' );
  1668 	$welcome_email = get_site_option( 'welcome_email' );
  1623 	if ( false == $welcome_email ) {
  1669 
       
  1670 	if ( ! $welcome_email ) {
  1624 		/* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
  1671 		/* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
  1625 		$welcome_email = __(
  1672 		$welcome_email = __(
  1626 			'Howdy USERNAME,
  1673 			'Howdy USERNAME,
  1627 
  1674 
  1628 Your new SITE_NAME site has been successfully set up at:
  1675 Your new SITE_NAME site has been successfully set up at:
  1826  * @param int    $user_id  User ID.
  1873  * @param int    $user_id  User ID.
  1827  * @param string $password User password.
  1874  * @param string $password User password.
  1828  * @param array  $meta     Optional. Signup meta data. Default empty array.
  1875  * @param array  $meta     Optional. Signup meta data. Default empty array.
  1829  * @return bool
  1876  * @return bool
  1830  */
  1877  */
  1831 function wpmu_welcome_user_notification( $user_id, $password, $meta = array() ) {
  1878 function wpmu_welcome_user_notification(
       
  1879 	$user_id,
       
  1880 	#[\SensitiveParameter]
       
  1881 	$password,
       
  1882 	$meta = array()
       
  1883 ) {
  1832 	$current_network = get_network();
  1884 	$current_network = get_network();
  1833 
  1885 
  1834 	/**
  1886 	/**
  1835 	 * Filters whether to bypass the welcome email after user activation.
  1887 	 * Filters whether to bypass the welcome email after user activation.
  1836 	 *
  1888 	 *
  2019  *
  2071  *
  2020  * @param string $deprecated Not used.
  2072  * @param string $deprecated Not used.
  2021  */
  2073  */
  2022 function update_posts_count( $deprecated = '' ) {
  2074 function update_posts_count( $deprecated = '' ) {
  2023 	global $wpdb;
  2075 	global $wpdb;
  2024 	update_option( 'post_count', (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ) );
  2076 	update_option( 'post_count', (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ), true );
  2025 }
  2077 }
  2026 
  2078 
  2027 /**
  2079 /**
  2028  * Logs the user email, IP, and registration date of a new site.
  2080  * Logs the user email, IP, and registration date of a new site.
  2029  *
  2081  *
  2252  *
  2304  *
  2253  * @param int    $user_id  User ID.
  2305  * @param int    $user_id  User ID.
  2254  * @param string $password User password. Ignored.
  2306  * @param string $password User password. Ignored.
  2255  * @param array  $meta     Signup meta data.
  2307  * @param array  $meta     Signup meta data.
  2256  */
  2308  */
  2257 function add_new_user_to_blog( $user_id, $password, $meta ) {
  2309 function add_new_user_to_blog(
       
  2310 	$user_id,
       
  2311 	#[\SensitiveParameter]
       
  2312 	$password,
       
  2313 	$meta
       
  2314 ) {
  2258 	if ( ! empty( $meta['add_to_blog'] ) ) {
  2315 	if ( ! empty( $meta['add_to_blog'] ) ) {
  2259 		$blog_id = $meta['add_to_blog'];
  2316 		$blog_id = $meta['add_to_blog'];
  2260 		$role    = $meta['new_role'];
  2317 		$role    = $meta['new_role'];
  2261 		remove_user_from_blog( $user_id, get_network()->site_id ); // Remove user from main blog.
  2318 		remove_user_from_blog( $user_id, get_network()->site_id ); // Remove user from main blog.
  2262 
  2319 
  2271 /**
  2328 /**
  2272  * Corrects From host on outgoing mail to match the site domain.
  2329  * Corrects From host on outgoing mail to match the site domain.
  2273  *
  2330  *
  2274  * @since MU (3.0.0)
  2331  * @since MU (3.0.0)
  2275  *
  2332  *
  2276  * @param PHPMailer $phpmailer The PHPMailer instance (passed by reference).
  2333  * @param PHPMailer\PHPMailer\PHPMailer $phpmailer The PHPMailer instance (passed by reference).
  2277  */
  2334  */
  2278 function fix_phpmailer_messageid( $phpmailer ) {
  2335 function fix_phpmailer_messageid( $phpmailer ) {
  2279 	$phpmailer->Hostname = get_network()->domain;
  2336 	$phpmailer->Hostname = get_network()->domain;
  2280 }
  2337 }
  2281 
  2338 
  2295 		} else {
  2352 		} else {
  2296 			$user = wp_get_current_user();
  2353 			$user = wp_get_current_user();
  2297 		}
  2354 		}
  2298 	}
  2355 	}
  2299 
  2356 
  2300 	return $user && isset( $user->spam ) && 1 == $user->spam;
  2357 	return $user && isset( $user->spam ) && '1' === $user->spam;
  2301 }
  2358 }
  2302 
  2359 
  2303 /**
  2360 /**
  2304  * Updates this blog's 'public' setting in the global blogs table.
  2361  * Updates this blog's 'public' setting in the global blogs table.
  2305  *
  2362  *