newuser_notify_siteadmin()当有新用户注册时发送一个提醒给管理员

目录

描述

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

newuser_notify_siteadmin() 描述

用法

<?php newuser_notify_siteadmin$user_id ?>

newuser_notify_siteadmin() 用法

参数

$user_id

(integer) (必填) The new user ID

默认值: None

newuser_notify_siteadmin() 参数

示例

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */

newuser_notify_siteadmin() 示例

注意

Filter 'newuser_notify_siteadmin' to change the content of the notification email. Filter function is passed $msg (the email message text), $user (a WP_User object for the new user)

newuser_notify_siteadmin() 注意

历史

添加于 版本: MU

newuser_notify_siteadmin() 历史

源文件

newuser_notify_siteadmin() 函数的代码位于 wp-includes/ms-functions.php

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * 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;
}

newuser_notify_siteadmin() 源文件

相关