Make WordPress Core

Changeset 21798


Ignore:
Timestamp:
09/10/2012 07:56:08 PM (12 years ago)
Author:
ryan
Message:

When reassigning posts and links during user deletion, clear the post and link caches. Props kurtpayne. fixes #20447

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/user.php

    r21496 r21798  
    271271    } else {
    272272        $reassign = (int) $reassign;
     273        $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );
    273274        $wpdb->update( $wpdb->posts, array('post_author' => $reassign), array('post_author' => $id) );
     275        if ( ! empty( $post_ids ) ) {
     276            foreach ( $post_ids as $post_id )
     277                clean_post_cache( $post_id );
     278        }
     279        $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) );
    274280        $wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) );
     281        if ( ! empty( $link_ids ) ) {
     282            foreach ( $link_ids as $link_id )
     283                clean_bookmark_cache( $link_id );
     284        }
    275285    }
    276286
Note: See TracChangeset for help on using the changeset viewer.