newuser_notify_siteadmin() - WordPress 函数参考中文文档

返回介绍

newuser_notify_siteadmin()

发布于 2017-09-11 字数2500 浏览 922 评论 0

newuser_notify_siteadmin( int $user_id )

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


描述

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


参数

$user_id

(int)
(Required)
The new user’s ID.


返回值

(bool)


源代码

File: wp-includes/ms-functions.php

function newuser_notify_siteadmin( $user_id ) {
	if ( get_site_option( 'registrationnotification' ) != 'yes' )
		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'));
	/* translators: New user notification email. 1: User login, 2: User IP address, 3: Settings screen URL */
	$msg = sprintf(__('New User: %1$s
Remote IP: %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
	 *
	 * @param string  $msg  Email body.
	 * @param WP_User $user WP_User instance of the new user.
	 */
	$msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user );
	wp_mail( $email, sprintf(__('New User Registration: %s'), $user->user_login), $msg );
	return true;
}

更新日志

Version 描述
MU Introduced.

相关函数

Uses

  • wp-includes/l10n.php:
    __()
  • wp-includes/formatting.php:
    wp_unslash()
  • wp-includes/formatting.php:
    esc_url()
  • wp-includes/formatting.php:
    is_email()
  • wp-includes/pluggable.php:
    get_userdata()
  • wp-includes/pluggable.php:
    wp_mail()
  • wp-includes/link-template.php:
    network_admin_url()
  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/option.php:
    get_site_option()
  • wp-includes/ms-functions.php:
    newuser_notify_siteadmin
  • Show 5 more uses
    Hide more uses


User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!