newuser_notify_siteadmin
apply_filters( ‘newuser_notify_siteadmin’, string $msg,…
apply_filters( ‘newuser_notify_siteadmin’, string $msg, WP_User $user )
筛选挂钩:筛选发送给网络管理员的新用户激活电子邮件的邮件正文。
Filter Hook: Filters the message body of the new user activation email sent to the network administrator.
目录锚点:#参数#源码
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $msg | (string) | 电子邮件正文。 |
| $user | (WP_User) | 新用户的WP_用户实例。 |
源码(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;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| MU (3.0.0) | wp-includes/ms-functions.php:1497 | 1 | 0 |
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!