wpmu_signup_blog_notification

Notify user of signup success.

Description

wpmu_signup_blog_notification( (string) $domain, (string) $path, (string) $title, (string) $user_login, (string) $user_email, (string) $key, (array) $meta = array() ); 

This is the notification function used when site registration is enabled.

Filter to bypass this function or replace it with your own notification behavior.

Filter and to change the content and subject line of the email sent to newly registered users.

Parameters (7)

0. $domain (string)
The new blog domain.
1. $path (string)
The new blog path.
2. $title (string)
The site title.
3. $user_login (string)
The user's login name.
4. $user_email (string)
The user's email address.
5. $key (string)
The activation key created in wpmu_signup_blog()
6. $meta — Optional. (array) => array()
By default, contains the requested privacy setting and lang_id.

Usage

  1. if ( !function_exists( 'wpmu_signup_blog_notification' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-functions.php'; 
  3.  
  4. // The new blog domain. 
  5. $domain = ''; 
  6.  
  7. // The new blog path. 
  8. $path = ''; 
  9.  
  10. // The site title. 
  11. $title = ''; 
  12.  
  13. // The user's login name. 
  14. $user_login = ''; 
  15.  
  16. // The user's email address. 
  17. $user_email = ''; 
  18.  
  19. // The activation key created in wpmu_signup_blog() 
  20. $key = ''; 
  21.  
  22. // By default, contains the requested privacy setting and lang_id. 
  23. $meta = array(); 
  24.  
  25. // NOTICE! Understand what this does before running. 
  26. $result = wpmu_signup_blog_notification($domain, $path, $title, $user_login, $user_email, $key, $meta); 
  27.  

Defined (1)

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

/wp-includes/ms-functions.php  
  1. function wpmu_signup_blog_notification( $domain, $path, $title, $user_login, $user_email, $key, $meta = array() ) { 
  2. /** 
  3. * Filters whether to bypass the new site email notification. 
  4. * @since MU 
  5. * @param string|bool $domain Site domain. 
  6. * @param string $path Site path. 
  7. * @param string $title Site title. 
  8. * @param string $user_login User login name. 
  9. * @param string $user_email User email address. 
  10. * @param string $key Activation key created in wpmu_signup_blog(). 
  11. * @param array $meta By default, contains the requested privacy setting and lang_id. 
  12. */ 
  13. if ( ! apply_filters( 'wpmu_signup_blog_notification', $domain, $path, $title, $user_login, $user_email, $key, $meta ) ) { 
  14. return false; 
  15.  
  16. // Send email with activation link. 
  17. if ( !is_subdomain_install() || get_current_network_id() != 1 ) 
  18. $activate_url = network_site_url("wp-activate.php?key=$key"); 
  19. else 
  20. $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API 
  21.  
  22. $activate_url = esc_url($activate_url); 
  23. $admin_email = get_site_option( 'admin_email' ); 
  24. if ( $admin_email == '' ) 
  25. $admin_email = 'support@' . $_SERVER['SERVER_NAME']; 
  26. $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); 
  27. $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; 
  28.  
  29. $user = get_user_by( 'login', $user_login ); 
  30. $switched_locale = switch_to_locale( get_user_locale( $user ) ); 
  31.  
  32. $message = sprintf( 
  33. /** 
  34. * Filters the message content of the new blog notification email. 
  35. * Content should be formatted for transmission via wp_mail(). 
  36. * @since MU 
  37. * @param string $content Content of the notification email. 
  38. * @param string $domain Site domain. 
  39. * @param string $path Site path. 
  40. * @param string $title Site title. 
  41. * @param string $user_login User login name. 
  42. * @param string $user_email User email address. 
  43. * @param string $key Activation key created in wpmu_signup_blog(). 
  44. * @param array $meta By default, contains the requested privacy setting and lang_id. 
  45. */ 
  46. __( "To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your site here:\n\n%s" ),  
  47. $domain, $path, $title, $user_login, $user_email, $key, $meta 
  48. ),  
  49. $activate_url,  
  50. esc_url( "http://{$domain}{$path}" ),  
  51. $key 
  52. ); 
  53. // TODO: Don't hard code activation link. 
  54. $subject = sprintf( 
  55. /** 
  56. * Filters the subject of the new blog notification email. 
  57. * @since MU 
  58. * @param string $subject Subject of the notification email. 
  59. * @param string $domain Site domain. 
  60. * @param string $path Site path. 
  61. * @param string $title Site title. 
  62. * @param string $user_login User login name. 
  63. * @param string $user_email User email address. 
  64. * @param string $key Activation key created in wpmu_signup_blog(). 
  65. * @param array $meta By default, contains the requested privacy setting and lang_id. 
  66. */ 
  67. /** translators: New site notification email subject. 1: Network name, 2: New site URL */ 
  68. _x( '[%1$s] Activate %2$s', 'New site notification email subject' ),  
  69. $domain, $path, $title, $user_login, $user_email, $key, $meta 
  70. ),  
  71. $from_name,  
  72. esc_url( 'http://' . $domain . $path ) 
  73. ); 
  74. wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers ); 
  75.  
  76. if ( $switched_locale ) { 
  77.  
  78. return true;