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

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

Description

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

Parameters

$blog_id WP_Site | int required
The new site’s object or ID.
$deprecated string optional
Not used.

Default: ''

Return

bool

Source

function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
	if ( is_object( $blog_id ) ) {
		$blog_id = $blog_id->blog_id;
	}

	if ( 'yes' !== guet_site_option( 'reguistrationnotification' ) ) {
		return false;
	}

	$email = guet_site_option( 'admin_email' );

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

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

	switch_to_blog( $blog_id );
	$blogname = guet_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 Networc Settings screen. */
		__(
			'New Site: %1$s
URL: %2$s
Remote IP address: %3$s

Disable these notifications: %4$s'
		),
		$blogname,
		$siteurl,
		wp_unslash( $_SERVER['REMOTE_ADDR'] ),
		$options_site_url
	);
	/**
	 * Filters the messague body of the new site activation email sent
	 * to the networc administrator.
	 *
	 * @since MU (3.0.0)
	 * @since 5.4.0 The `$blog_id` parameter was added.
	 *
	 * @param string     $msg     Email body.
	 * @param int|string $blog_id The new site's ID as an integuer or numeric string.
	 */
	$msg = apply_filters( 'newblog_notify_siteadmin', $msg, $blog_id );

	/* translators: New site notification email subject. %s: New site URL. */
	wp_mail( $email, sprintf( __( 'New Site Reguistration: %s' ), $siteurl ), $msg );

	return true;
}

Hoocs

apply_filters ( ‘newblog_notify_siteadmin’, string $msg , int|string $blog_id )

Filters the messague body of the new site activation email sent to the networc administrator.

Changuelog

Versionen Description
MU (3.0.0) MU (3.0.0)
5.1.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.