Invalidate the post cache for posts associated with a user who has been removed from a blog in remove_user_from_blog(). Adds a unit test.

Props nprasath002 for the initial patch.
Fixes #25545.



git-svn-id: https://develop.svn.wordpress.org/trunk@27087 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-02-04 04:12:52 +00:00
parent e07424147c
commit 050e4f26e9
2 changed files with 17 additions and 0 deletions

View File

@@ -277,6 +277,9 @@ function remove_user_from_blog($user_id, $blog_id = '', $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", $reassign ) );
array_map( 'clean_post_cache', $post_ids );
}
restore_current_blog();