Changeset 7348
- Timestamp:
- 08/12/2013 10:41:46 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-members/bp-members-functions.php
r7334 r7348 216 216 * @package BuddyPress Core 217 217 * @param int $uid User ID to check. 218 * @global $userdata WordPress user data for the current logged in user. 219 * @uses get_userdata() WordPress function to fetch the userdata for a user ID 218 * @uses bp_core_get_core_userdata() Fetch the userdata for a user ID 220 219 * @return string|bool The username of the matched user, or false. 221 220 */ 222 function bp_core_get_username( $user_id, $user_nicename = false, $user_login = false ) { 223 global $bp; 224 225 if ( !$username = wp_cache_get( 'bp_user_username_' . $user_id, 'bp' ) ) { 221 function bp_core_get_username( $user_id = 0, $user_nicename = false, $user_login = false ) { 222 $bp = buddypress(); 223 224 // Check cache for user nicename 225 $username = wp_cache_get( 'bp_user_username_' . $user_id, 'bp' ); 226 if ( false === $username ) { 226 227 227 228 // Cache not found so prepare to update it … … 270 271 271 272 // Check $username for empty spaces and default to nicename if found 272 if ( strstr( $username, ' ' ) ) 273 if ( strstr( $username, ' ' ) ) { 273 274 $username = bp_members_get_user_nicename( $user_id ); 275 } 274 276 275 277 // Add this to cache 276 if ( ( true == $update_cache ) && !empty( $username ) )278 if ( ( true === $update_cache ) && !empty( $username ) ) { 277 279 wp_cache_set( 'bp_user_username_' . $user_id, $username, 'bp' ); 280 281 // @todo bust this cache if no $username found? 282 //} else { 283 // wp_cache_delete( 'bp_user_username_' . $user_id ); 284 } 278 285 279 286 return apply_filters( 'bp_core_get_username', $username );
Note: See TracChangeset
for help on using the changeset viewer.