newblog_notify_siteadmin

Advertisement

Summery Summery

Notifies the network admin that a new site has been activated.

Syntax Syntax

newblog_notify_siteadmin( WP_Site|int $blog_id, string $deprecated = '' )

Description Description

Filter ‘newblog_notify_siteadmin’ to change the content of the notification email.

Parameters Parameters

$blog_id

(WP_Site|int) (Required) The new site's object or ID.

$deprecated

(string) (Optional) Not used.

Default value: ''

Return Return

(bool)

Source Source

File: wp-includes/ms-functions.php

	);

	$blog_id = wp_insert_site( array_merge( $site_data, $site_initialization_data ) );

	if ( is_wp_error( $blog_id ) ) {
		return $blog_id;
	}

	wp_cache_set( 'last_changed', microtime(), 'sites' );

	return $blog_id;
}

/**
 * Notifies the network admin that a new site has been activated.
 *
 * Filter {@see 'newblog_notify_siteadmin'} to change the content of
 * the notification email.
 *
 * @since MU (3.0.0)
 * @since 5.1.0 $blog_id now supports input from the {@see 'wp_initialize_site'} action.
 *
 * @param WP_Site|int $blog_id    The new site's object or ID.
 * @param string      $deprecated Not used.
 * @return bool
 */
function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
	if ( is_object( $blog_id ) ) {
		$blog_id = $blog_id->blog_id;
	}

	if ( 'yes' !== get_site_option( 'registrationnotification' ) ) {
		return false;
	}

	$email = get_site_option( 'admin_email' );

	if ( is_email( $email ) == false ) {
		return false;
	}

	$options_site_url = esc_url( network_admin_url( 'settings.php' ) );

	switch_to_blog( $blog_id );
	$blogname = get_option( 'blogname' );
	$siteurl  = site_url();
	restore_current_blog();

	$msg = sprintf(
		/* translators: New site notification email. 1: Site URL, 2: User IP address, 3: URL to Network Settings screen. */
		__(
			'New Site: %1$s

Advertisement

Changelog Changelog

Changelog
Version Description
MU (3.0.0) MU (3.0.0)
5.1.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.