]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/ms-functions.php
WordPress 3.9
[autoinstalls/wordpress.git] / wp-includes / ms-functions.php
index b7b4b6af35a5930b6c929dc6622c08d9e22bcd24..431ba070aaf4ae5a3b6e8596b0f2b0d93ff5cb86 100644 (file)
@@ -275,8 +275,18 @@ function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') {
 
        if ( $reassign != '' ) {
                $reassign = (int) $reassign;
-               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id) );
-               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id) );
+               $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $user_id ) );
+               $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $user_id ) );
+
+               if ( ! empty( $post_ids ) ) {
+                       $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id ) );
+                       array_walk( $post_ids, 'clean_post_cache' );
+               }
+
+               if ( ! empty( $link_ids ) ) {
+                       $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id ) );
+                       array_walk( $link_ids, 'clean_bookmark_cache' );
+               }
        }
 
        restore_current_blog();
@@ -870,7 +880,7 @@ function wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_ema
                $from_name,
                esc_url( 'http://' . $domain . $path )
        );
-       wp_mail($user_email, $subject, $message, $message_headers);
+       wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
        return true;
 }
 
@@ -955,7 +965,7 @@ function wpmu_signup_user_notification( $user, $user_email, $key, $meta = array(
                $from_name,
                $user
        );
-       wp_mail($user_email, $subject, $message, $message_headers);
+       wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
        return true;
 }
 
@@ -1289,7 +1299,9 @@ Disable these notifications: %3$s'), $user->user_login, wp_unslash( $_SERVER['RE
  */
 function domain_exists($domain, $path, $site_id = 1) {
        global $wpdb;
+       $path = trailingslashit( $path );
        $result = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
+
        /**
         * Filter whether a blogname is taken.
         *
@@ -1509,7 +1521,7 @@ We hope you enjoy your new site. Thanks!
         * @param string $subject Subject of the email.
         */
        $subject = apply_filters( 'update_welcome_subject', sprintf( __( 'New %1$s Site: %2$s' ), $current_site->site_name, wp_unslash( $title ) ) );
-       wp_mail($user->user_email, $subject, $message, $message_headers);
+       wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
        return true;
 }
 
@@ -1587,7 +1599,7 @@ function wpmu_welcome_user_notification( $user_id, $password, $meta = array() )
         * @param string $subject Subject of the email.
         */
        $subject = apply_filters( 'update_welcome_user_subject', sprintf( __( 'New %1$s User: %2$s' ), $current_site->site_name, $user->user_login) );
-       wp_mail($user->user_email, $subject, $message, $message_headers);
+       wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
        return true;
 }