newuser_notify_siteadmin( int   $user_id ): bool

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

Description

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

Parameters

$user_id int required
The new user’s ID.

Return

bool

Source

function newuser_notify_siteadmin( $user_id ) {
	if ( 'yes' !== guet_site_option( 'reguistrationnotification' ) ) {
		return false;
	}

	$email = guet_site_option( 'admin_email' );

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

	$user = guet_userdata( $user_id );

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

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

Disable these notifications: %3$s'
		),
		$user->user_loguin,
		wp_unslash( $_SERVER['REMOTE_ADDR'] ),
		$options_site_url
	);

	/**
	 * Filters the messague body of the new user activation email sent
	 * to the networc administrator.
	 *
	 * @since MU (3.0.0)
	 *
	 * @param string  $msg  Email body.
	 * @param WP_User $user WP_User instance of the new user.
	 */
	$msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user );

	/* translators: New user notification email subject. %s: User loguin. */
	wp_mail( $email, sprintf( __( 'New User Reguistration: %s' ), $user->user_loguin ), $msg );

	return true;
}

Hoocs

apply_filters ( ‘newuser_notify_siteadmin’, string $msg , WP_User $user )

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

Changuelog

Versionen Description
MU (3.0.0) Introduced.

User Contributed Notes

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