Make WordPress Core

Ticket #26317: wordpress.patch

File wordpress.patch, 3.1 KB (added by vaurdan, 11 years ago)

The new patch, with new fixes and related to the SVN revision 27489

  • wp-includes/ms-functions.php

     
    15241524}
    15251525
    15261526/**
     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 */
     1541function 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
     1553Address: %2$s
     1554Name: %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/**
    15271573 * Notify a user that their account activation has been successful.
    15281574 *
    15291575 * Filter 'wpmu_welcome_user_notification' to disable or bypass.
  • wp-admin/network/site-new.php

     
    8484        if ( !is_wp_error( $id ) ) {
    8585                if ( !is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) )
    8686                        update_user_option( $user_id, 'primary_blog', $id, true );
    87                 $content_mail = sprintf( __( 'New site created by %1$s
    88 
    89 Address: %2$s
    90 Name: %3$s' ), $current_user->user_login , get_site_url( $id ), wp_unslash( $title ) );
    91                 wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
     87                wp_admin_new_site_notification( $id, $user_id, $title );
    9288                wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
    9389                wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) );
    9490                exit;