newuser_notify_siteadmin

函式
newuser_notify_siteadmin ( $user_id )
引數
  • (int) $user_id The new user's ID.
    Required:
返回值
  • (bool)
定義位置
相關方法
newblog_notify_siteadminwp_new_user_notificationwp_send_new_user_notificationsis_site_adminwpmu_signup_user_notification
引入
-
棄用
-

newuser_notify_siteadmin: 當一個新的使用者在網路安裝中被建立時,這個動作鉤子被觸發,並向網站管理員傳送通知郵件。

通知網路管理員一個新使用者已經被啟用。

過濾{@see ‘newuser_notify_siteadmin’}來改變通知郵件的內容。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function newuser_notify_siteadmin( $user_id ) {
if ( 'yes' !== get_site_option( 'registrationnotification' ) ) {
return false;
}
$email = get_site_option( 'admin_email' );
if ( is_email( $email ) == false ) {
return false;
}
$user = get_userdata( $user_id );
$options_site_url = esc_url( network_admin_url( 'settings.php' ) );
$msg = sprintf(
/* translators: New user notification email. 1: User login, 2: User IP address, 3: URL to Network Settings screen. */
__(
'New User: %1$s
Remote IP address: %2$s
Disable these notifications: %3$s'
),
$user->user_login,
wp_unslash( $_SERVER['REMOTE_ADDR'] ),
$options_site_url
);
/**
* Filters the message body of the new user activation email sent
* to the network 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 login. */
wp_mail( $email, sprintf( __( 'New User Registration: %s' ), $user->user_login ), $msg );
return true;
}
function newuser_notify_siteadmin( $user_id ) { if ( 'yes' !== get_site_option( 'registrationnotification' ) ) { return false; } $email = get_site_option( 'admin_email' ); if ( is_email( $email ) == false ) { return false; } $user = get_userdata( $user_id ); $options_site_url = esc_url( network_admin_url( 'settings.php' ) ); $msg = sprintf( /* translators: New user notification email. 1: User login, 2: User IP address, 3: URL to Network Settings screen. */ __( 'New User: %1$s Remote IP address: %2$s Disable these notifications: %3$s' ), $user->user_login, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url ); /** * Filters the message body of the new user activation email sent * to the network 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 login. */ wp_mail( $email, sprintf( __( 'New User Registration: %s' ), $user->user_login ), $msg ); return true; }
function newuser_notify_siteadmin( $user_id ) {
	if ( 'yes' !== get_site_option( 'registrationnotification' ) ) {
		return false;
	}

	$email = get_site_option( 'admin_email' );

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

	$user = get_userdata( $user_id );

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

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

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

	/**
	 * Filters the message body of the new user activation email sent
	 * to the network 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 login. */
	wp_mail( $email, sprintf( __( 'New User Registration: %s' ), $user->user_login ), $msg );

	return true;
}

常見問題

FAQs
檢視更多 >