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. Built from https://develop.svn.wordpress.org/trunk@27087 git-svn-id: http://core.svn.wordpress.org/trunk@26959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
93d3e3efb6
commit
274d2925b9
|
@ -277,6 +277,9 @@ function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') {
|
||||||
$reassign = (int) $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->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) );
|
$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();
|
restore_current_blog();
|
||||||
|
|
Loading…
Reference in New Issue