Ticket #3918: 3918.02.3.patch
File 3918.02.3.patch, 3.0 KB (added by , 12 years ago) |
---|
-
bp-members/bp-members-functions.php
131 131 * 132 132 * @package BuddyPress Core 133 133 * @param user_id The ID of the user. 134 * @param $use_cache False if you want to skip the WP cache check 134 135 * @uses BP_Core_User::get_core_userdata() Performs the query. 135 136 */ 136 function bp_core_get_core_userdata( $user_id ) { 137 function bp_core_get_core_userdata( $user_id = 0, $use_cache = true ) { 138 139 // Sanity check incase $user_id passed cannot be trusted 137 140 if ( empty( $user_id ) ) 138 141 return false; 139 142 140 if ( !$userdata = wp_cache_get( 'bp_core_userdata_' . $user_id, 'bp' ) ) { 143 // Prevent possible debug notice 144 $userdata = false; 145 146 // Only skip cache if explicitly false 147 if ( true === $use_cache ) 148 $userdata = wp_cache_get( 'bp_core_userdata_' . $user_id, 'bp' ); 149 150 // Manually load userdata from the DB if it's missing 151 if ( empty( $userdata ) ) { 141 152 $userdata = BP_Core_User::get_core_userdata( $user_id ); 142 153 wp_cache_set( 'bp_core_userdata_' . $user_id, $userdata, 'bp' ); 143 154 } 144 return apply_filters( 'bp_core_get_core_userdata', $userdata ); 155 156 // Filter and return the userdata 157 return apply_filters( 'bp_core_get_core_userdata', $userdata, $user_id, $use_cache ); 145 158 } 146 159 147 160 /** -
bp-settings/bp-settings-actions.php
24 24 if ( is_super_admin() || ( !empty( $_POST['pwd'] ) && $_POST['pwd'] != '' && wp_check_password( $_POST['pwd'], $bp->displayed_user->userdata->user_pass, $bp->displayed_user->id ) ) ) { 25 25 26 26 $update_user = get_userdata( $bp->displayed_user->id ); 27 28 // The structure of the $update_user object changed in WP 3.3, but 29 // wp_update_user() still expects the old format 30 if ( isset( $update_user->data ) && is_object( $update_user->data ) ) { 31 $update_user = $update_user->data; 32 } 27 33 28 34 // Make sure changing an email address does not already exist 29 35 if ( $_POST['email'] != '' ) { … … 80 86 unset( $update_user->user_pass ); 81 87 } 82 88 83 // The structure of the $update_user object changed in WP 3.3, but84 // wp_update_user() still expects the old format85 if ( isset( $update_user->data ) && is_object( $update_user->data ) ) {86 $update_user = $update_user->data;87 }88 89 89 // Make sure these changes are in $bp for the current page load 90 90 if ( ( false === $email_error ) && ( false === $pass_error ) && ( wp_update_user( get_object_vars( $update_user ) ) ) ) { 91 $bp->displayed_user->userdata = bp_core_get_core_userdata( $bp->displayed_user->id ); 92 $bp_settings_updated = true; 91 92 // Note that bp_core_get_core_userdata $skip_cache is true here 93 // to prevent displaying cached values on page reload 94 $bp->displayed_user->userdata = bp_core_get_core_userdata( $bp->displayed_user->id, true ); 95 $bp_settings_updated = true; 93 96 } 94 97 95 98 // Password Error