Skip to:
Content

BuddyPress.org

Ticket #5098: 5098.01.patch

File 5098.01.patch, 2.2 KB (added by r-a-y, 11 years ago)
  • bp-members/bp-members-functions.php

    function bp_core_get_user_domain( $user_id, $user_nicename = false, $user_login 
    149149/**
    150150 * Fetch everything in the wp_users table for a user, without any usermeta.
    151151 *
    152  * @package BuddyPress Core
    153  * @param int $user_id The ID of the user.
     152 * @since BuddyPress (1.2.0)
     153 *
    154154 * @uses BP_Core_User::get_core_userdata() Performs the query.
     155 *
     156 * @param int $user_id The ID of the user.
     157 * @param bool $requery Should we requery and reset the cache for the user's data.
     158 * @return array|bool Array of userdata on success. Boolean false on failure.
    155159 */
    156 function bp_core_get_core_userdata( $user_id ) {
     160function bp_core_get_core_userdata( $user_id = 0, $requery = false ) {
    157161        if ( empty( $user_id ) )
    158162                return false;
    159163
    160         if ( !$userdata = wp_cache_get( 'bp_core_userdata_' . $user_id, 'bp' ) ) {
     164        // get cache if we're not requerying
     165        if ( ! $requery ) {
     166                $userdata = wp_cache_get( 'bp_core_userdata_' . $user_id, 'bp' );
     167        }
     168
     169        // query for userdata if we're explicitly requerying or if cache doesn't exist
     170        if ( (bool) $requery === true || $userdata === false ) {
    161171                $userdata = BP_Core_User::get_core_userdata( $user_id );
    162172                wp_cache_set( 'bp_core_userdata_' . $user_id, $userdata, 'bp' );
    163173        }
    164         return apply_filters( 'bp_core_get_core_userdata', $userdata );
     174        return apply_filters( 'bp_core_get_core_userdata', $userdata, $user_id );
    165175}
    166176
    167177/**
  • bp-settings/bp-settings-actions.php

    function bp_settings_action_general() { 
    143143
    144144                // Make sure these changes are in $bp for the current page load
    145145                if ( ( false === $email_error ) && ( false === $pass_error ) && ( wp_update_user( $update_user ) ) ) {
    146                         $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() );
     146                        $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id(), true );
    147147                }
    148148
    149149        // Password Error