Make WordPress Core

Ticket #26317: WordPress-patch.patch

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

Patch to implement this enhancement

  • wp-includes/ms-functions.php

     
    12531253}
    12541254
    12551255/**
     1256 * Notify the network administration email that a new blog has been created on the network.
     1257 *
     1258 * Filter 'wpmu_admin_new_site_notification' to disable or bypass.
     1259 *
     1260 * Filter 'update_new_site_notification_email' and 'update_new_site_notification_subject' to
     1261 * modify the content and subject line of the notification email.
     1262 *
     1263 * @since MU
     1264 *
     1265 * @param string $user_name The user who created the new blog
     1266 * @param string $address The new blog's URL
     1267 * @param string $title The new blog's title
     1268 * @return bool
     1269 */
     1270function wpmu_admin_new_site_notification( $user_name, $address, $title ) {
     1271        global $current_site;
     1272
     1273        if ( !apply_filters('wpmu_admin_new_site_notification', $user_name, $address, $title) )
     1274                return false;
     1275
     1276        $content_mail = sprintf( __( 'New site created by %1$s
     1277
     1278Address: %2$s
     1279Name: %3$s' ), $user_name , $address, wp_unslash($title) );
     1280       
     1281        $content_mail = apply_filters( 'update_new_site_notification_email', $user_name, $add, $title);
     1282       
     1283        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
     1284        $from_email = get_site_option( 'admin_email' );
     1285
     1286        $message_headers = "From: \"{$from_name}\" <{$from_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
     1287        $message = $content_mail;
     1288       
     1289        if ( empty( $current_site->site_name ) )
     1290                $current_site->site_name = 'WordPress';
     1291
     1292        $subject = apply_filters( 'update_new_site_notification_subject', sprintf( __('[%s] New Site Created' ), $current_site->site_name) );
     1293        wp_mail( get_site_option( 'admin_email' ), $subject, $message, $message_headers );
     1294        return true;           
     1295}
     1296
     1297/**
    12561298 * Notify a user that their account activation has been successful.
    12571299 *
    12581300 * 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
     87               
     88                $user_name = $current_user->user_login;
     89                $address = get_site_url( $id );
    8890
    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' ) . '>' );
     91                wpmu_admin_new_site_notification( $user_name, $address, $title );
    9292                wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
    9393                wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) );
    9494                exit;