newuser_notify_siteadmin()

通知网络管理员新用户已激活。

newuser_notify_siteadmin( int $user_id )

说明(Description)

筛选“newuser_notify_siteadmin”以更改通知电子邮件的内容。


参数(Parameters)

参数类型必填说明
$user_id(int)必需新用户的ID。

返回(Return)

(bool)


源码(Source)

/**
 * Notifies the network admin that a new user has been activated.
 *
 * Filter 'newuser_notify_siteadmin' to change the content of
 * the notification email.
 *
 * @since MU
 *
 * @param int $user_id The new user's ID.
 * @return bool
 */
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'));
	$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);
 
	/**
	 * Filter 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;
}
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索