newuser_notify_siteadmin() WordPress Function
The newuser_notify_siteadmin() function is used to notify the site administrator about a new user registration. This function is triggered when a new user registers on the site. It sends an email to the administrator with the new user's information.
newuser_notify_siteadmin( int $user_id ) #
Notifies the network admin that a new user has been activated.
Description
Filter ‘newuser_notify_siteadmin’ to change the content of the notification email.
Parameters
- $user_id
(int)(Required)The new user's ID.
Return
(bool)
Source
File: wp-includes/ms-functions.php
1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 | 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; } |
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
MU (3.0.0) | Introduced. |