Ticket #5979: 5979.patch
File 5979.patch, 2.2 KB (added by , 10 years ago) |
---|
-
src/bp-core/bp-core-classes.php
483 483 484 484 ), $this ) ); 485 485 486 // WP_User_Query doesn't cache the data it pulls from wp_users,487 // and it does not give us a way to save queries by fetching488 // only uncached users. However, BP does cache this data, so489 // we set it here.490 foreach ( $wp_user_query->results as $u ) {491 wp_cache_set( 'bp_core_userdata_' . $u->ID, $u, 'bp' );492 }493 494 486 // We calculate total_users using a standalone query, except 495 487 // when a whitelist of user_ids is passed to the constructor. 496 488 // This clause covers the latter situation, and ensures that -
src/bp-members/bp-members-functions.php
178 178 * @return array 179 179 */ 180 180 function bp_core_get_core_userdata( $user_id = 0 ) { 181 if ( empty( $user_id ) ) {182 return false;183 }184 181 185 if ( !$userdata = wp_cache_get( 'bp_core_userdata_' . $user_id, 'bp' ) ) {186 $userdata = BP_Core_User::get_core_userdata( $user_id );187 wp_cache_set( 'bp_core_userdata_' . $user_id, $userdata, 'bp' );188 } 189 return apply_filters( 'bp_core_get_core_userdata', $userdata );182 $userdata = ! empty( $user_id ) 183 ? BP_Core_User::get_core_userdata( $user_id ) 184 : false; 185 186 return apply_filters( 'bp_core_get_core_userdata', $userdata, $user_id ); 190 187 } 191 188 192 189 /** -
src/bp-settings/bp-settings-actions.php
196 196 // Clear cached data, so that the changed settings take effect 197 197 // on the current page load 198 198 if ( ( false === $email_error ) && ( false === $pass_error ) && ( wp_update_user( $update_user ) ) ) { 199 wp_cache_delete( 'bp_core_userdata_' . bp_displayed_user_id(), 'bp' );200 199 $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() ); 201 200 } 202 201 … … 439 438 ) ); 440 439 441 440 if ( $email_changed ) { 442 // Delete object cache for displayed user443 wp_cache_delete( 'bp_core_userdata_' . bp_displayed_user_id(), 'bp' );444 441 445 442 // Delete the pending email change key 446 443 bp_delete_user_meta( bp_displayed_user_id(), 'pending_email_change' );