From 41a987302263089ab3ca420c718cee584c96991c Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 21 Apr 2010 18:25:03 +0000 Subject: [PATCH] Clear the users cache when updating user metadata. fixes #13075 git-svn-id: http://svn.automattic.com/wordpress/trunk@14179 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/meta.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wp-includes/meta.php b/wp-includes/meta.php index 30b38d28b4..615fd05a94 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -59,6 +59,9 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = ) ); wp_cache_delete($object_id, $meta_type . '_meta'); + // users cache stores usermeta that must be cleared. + if ( 'user' == $meta_type ) + wp_cache_delete($object_id, 'users'); do_action( "added_{$meta_type}_meta", $wpdb->insert_id, $object_id, $meta_key, $meta_value ); @@ -119,6 +122,9 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v $wpdb->update( $table, $data, $where ); wp_cache_delete($object_id, $meta_type . '_meta'); + // users cache stores usermeta that must be cleared. + if ( 'user' == $meta_type ) + wp_cache_delete($object_id, 'users'); do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $meta_value ); @@ -181,6 +187,9 @@ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $d return false; wp_cache_delete($object_id, $meta_type . '_meta'); + // users cache stores usermeta that must be cleared. + if ( 'user' == $meta_type ) + wp_cache_delete($object_id, 'users'); do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $meta_value );