newuser_notify_siteadmin

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

Description

newuser_notify_siteadmin( (int) $user_id ); 

Filter to change the content of the notification email.

Parameters (1)

0. $user_id (int)
The new user's ID.

Usage

  1. if ( !function_exists( 'newuser_notify_siteadmin' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-functions.php'; 
  3.  
  4. // The new user's ID. 
  5. $user_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = newuser_notify_siteadmin($user_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-functions.php  
  1. function newuser_notify_siteadmin( $user_id ) { 
  2. if ( get_site_option( 'registrationnotification' ) != 'yes' ) 
  3. return false; 
  4.  
  5. $email = get_site_option( 'admin_email' ); 
  6.  
  7. if ( is_email($email) == false ) 
  8. return false; 
  9.  
  10. $user = get_userdata( $user_id ); 
  11.  
  12. $options_site_url = esc_url(network_admin_url('settings.php')); 
  13. /** translators: New user notification email. 1: User login, 2: User IP address, 3: Settings screen URL */ 
  14. $msg = sprintf(__('New User: %1$s 
  15. Remote IP: %2$s 
  16.  
  17. Disable these notifications: %3$s'), $user->user_login, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url); 
  18.  
  19. /** 
  20. * Filters the message body of the new user activation email sent 
  21. * to the network administrator. 
  22. * @since MU 
  23. * @param string $msg Email body. 
  24. * @param WP_User $user WP_User instance of the new user. 
  25. */ 
  26. $msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user ); 
  27. wp_mail( $email, sprintf(__('New User Registration: %s'), $user->user_login), $msg ); 
  28. return true;