| 1527 | * Notify the network administration email that a new blog has been created on the network. |
| 1528 | * |
| 1529 | * Filter 'wp_admin_new_site_notification' to disable or bypass. |
| 1530 | * |
| 1531 | * Filter 'update_new_site_notification_email' and 'update_new_site_notification_subject' to |
| 1532 | * modify the content and subject line of the notification email. |
| 1533 | * |
| 1534 | * @since 3.9 |
| 1535 | * |
| 1536 | * @param string $blog_id The ID of the new blog |
| 1537 | * @param string $user_id The user who created the new blog |
| 1538 | * @param string $title The new blog's title |
| 1539 | * @return bool |
| 1540 | */ |
| 1541 | function wp_admin_new_site_notification( $blog_id, $user_id, $title ) { |
| 1542 | $current_site = get_current_site(); |
| 1543 | $user = get_userdata( $user_id ); |
| 1544 | |
| 1545 | $url = get_blogaddress_by_id($blog_id); |
| 1546 | $user_name = $user->user_login; |
| 1547 | |
| 1548 | if ( !apply_filters('wp_admin_new_site_notification', $user_name, $url, $title) ) |
| 1549 | return false; |
| 1550 | |
| 1551 | $content_mail = sprintf( __( 'New site created by %1$s |
| 1552 | |
| 1553 | Address: %2$s |
| 1554 | Name: %3$s' ), $user_name , $url, wp_unslash($title) ); |
| 1555 | |
| 1556 | $content_mail = apply_filters( 'update_new_site_notification_email', $user_name, $add, $title); |
| 1557 | |
| 1558 | $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); |
| 1559 | $from_email = get_site_option( 'admin_email' ); |
| 1560 | |
| 1561 | $message_headers = "From: \"{$from_name}\" <{$from_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; |
| 1562 | $message = $content_mail; |
| 1563 | |
| 1564 | if ( empty( $current_site->site_name ) ) |
| 1565 | $current_site->site_name = 'WordPress'; |
| 1566 | |
| 1567 | $subject = apply_filters( 'update_new_site_notification_subject', sprintf( __('[%s] New Site Created' ), $current_site->site_name) ); |
| 1568 | wp_mail( get_site_option( 'admin_email' ), $subject, $message, $message_headers ); |
| 1569 | return true; |
| 1570 | } |
| 1571 | |
| 1572 | /** |