Skip to:
Content

BuddyPress.org

Ticket #5979: 5979.patch

File 5979.patch, 2.2 KB (added by johnjamesjacoby, 5 years ago)
  • src/bp-core/bp-core-classes.php

     
    483483
    484484                ), $this ) );
    485485
    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 fetching
    488                 // only uncached users. However, BP does cache this data, so
    489                 // 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 
    494486                // We calculate total_users using a standalone query, except
    495487                // when a whitelist of user_ids is passed to the constructor.
    496488                // This clause covers the latter situation, and ensures that
  • src/bp-members/bp-members-functions.php

     
    178178 * @return array
    179179 */
    180180function bp_core_get_core_userdata( $user_id = 0 ) {
    181         if ( empty( $user_id ) ) {
    182                 return false;
    183         }
    184181
    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 );
    190187}
    191188
    192189/**
  • src/bp-settings/bp-settings-actions.php

     
    196196                // Clear cached data, so that the changed settings take effect
    197197                // on the current page load
    198198                if ( ( false === $email_error ) && ( false === $pass_error ) && ( wp_update_user( $update_user ) ) ) {
    199                         wp_cache_delete( 'bp_core_userdata_' . bp_displayed_user_id(), 'bp' );
    200199                        $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() );
    201200                }
    202201
     
    439438                ) );
    440439
    441440                if ( $email_changed ) {
    442                         // Delete object cache for displayed user
    443                         wp_cache_delete( 'bp_core_userdata_' . bp_displayed_user_id(), 'bp' );
    444441
    445442                        // Delete the pending email change key
    446443                        bp_delete_user_meta( bp_displayed_user_id(), 'pending_email_change' );