Changeset 2285
- Timestamp:
- 01/10/2010 11:38:25 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
bp-activity.php (modified) (2 diffs)
-
bp-core.php (modified) (3 diffs)
-
bp-core/bp-core-classes.php (modified) (1 diff)
-
bp-core/bp-core-templatetags.php (modified) (1 diff)
-
bp-friends.php (modified) (3 diffs)
-
bp-friends/bp-friends-templatetags.php (modified) (2 diffs)
-
bp-groups.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r2282 r2285 249 249 if ( $activity->component_name == $bp->groups->id ) { 250 250 if ( $activity->user_id ) 251 $redirect = bp_core_get_user url( $activity->user_id) . $bp->activity->slug . '/' . $activity->id;251 $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id; 252 252 else { 253 253 if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) … … 255 255 } 256 256 } else 257 $redirect = bp_core_get_user url( $activity->user_id) . $bp->activity->slug . '/' . $activity->id;257 $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id; 258 258 259 259 if ( !$redirect ) -
trunk/bp-core.php
r2276 r2285 537 537 if ( !$user_id ) return; 538 538 539 if ( $domain = wp_cache_get( 'bp_user_domain_' . $user_id, 'bp' ) ) 540 return apply_filters( 'bp_core_get_user_domain', $domain ); 541 542 if ( !$user_nicename && !$user_login ) { 543 $ud = get_userdata($user_id); 544 $user_nicename = $ud->user_nicename; 545 $user_login = $ud->user_login; 546 } 547 548 if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) ) 549 $username = $user_login; 550 else 551 $username = $user_nicename; 552 553 /* If we are using a members slug, include it. */ 554 if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) ) 555 $domain = $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $username . '/'; 556 else 557 $domain = $bp->root_domain . '/' . $username . '/'; 558 559 /* Cache the link */ 560 wp_cache_set( 'bp_user_domain_' . $user_id, $domain, 'bp' ); 539 if ( !$domain = wp_cache_get( 'bp_user_domain_' . $user_id, 'bp' ) ) { 540 $username = bp_core_get_username( $user_id, $user_nicename, $user_login ); 541 542 /* If we are using a members slug, include it. */ 543 if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) ) 544 $domain = $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $username . '/'; 545 else 546 $domain = $bp->root_domain . '/' . $username . '/'; 547 548 /* Cache the link */ 549 wp_cache_set( 'bp_user_domain_' . $user_id, $domain, 'bp' ); 550 } 561 551 562 552 return apply_filters( 'bp_core_get_user_domain', $domain ); 563 553 } 554 /* DEPRECATED */ 555 function bp_core_get_userurl( $uid ) { return bp_core_get_user_domain( $uid ); } 564 556 565 557 /** … … 992 984 * @return str the username of the matched user. 993 985 */ 994 function bp_core_get_username( $uid ) { 995 global $userdata; 996 997 if ( $uid == $userdata->ID ) 998 $username = __( 'You', 'buddypress' ); 999 1000 if ( !$ud = get_userdata($uid) ) 1001 return false; 1002 1003 $username = $ud->user_login; 986 function bp_core_get_username( $uid, $user_nicename = false, $user_login = false ) { 987 global $bp; 988 989 if ( !$username = wp_cache_get( 'bp_user_username_' . $uid, 'bp' ) ) { 990 if ( empty( $user_nicename ) && empty( $user_login ) ) { 991 $ud = false; 992 993 if ( $bp->loggedin_user->id == $uid ) 994 $ud = &$bp->loggedin_user->userdata; 995 996 if ( $bp->displayed_user->id == $uid ) 997 $ud = &$bp->displayed_user->userdata; 998 999 if ( empty( $ud ) ) { 1000 if ( !$ud = bp_core_get_core_userdata($uid) ) 1001 return false; 1002 1003 $user_nicename = $ud->user_nicename; 1004 $user_login = $ud->user_login; 1005 } 1006 } 1007 1008 if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) ) 1009 $username = $user_login; 1010 else 1011 $username = $user_nicename; 1012 } 1013 1014 /* Add this to cache */ 1015 wp_cache_set( 'bp_user_username_' . $uid, 'bp' ); 1004 1016 1005 1017 return apply_filters( 'bp_core_get_username', $username ); 1006 }1007 1008 /**1009 * bp_core_get_userurl()1010 *1011 * Returns the URL with no HTML markup for a user based on their user id.1012 *1013 * @package BuddyPress Core1014 * @param $uid int User ID to check.1015 * @global $userdata WordPress user data for the current logged in user.1016 * @uses get_userdata() WordPress function to fetch the userdata for a user ID1017 * @return false on no match1018 * @return str The URL for the user with no HTML formatting.1019 */1020 function bp_core_get_userurl( $uid ) {1021 global $bp;1022 1023 if ( !$url = wp_cache_get( 'bp_user_url_' . $uid, 'bp' ) ) {1024 $url = bp_core_get_user_domain( $uid );1025 }1026 1027 return apply_filters( 'bp_core_get_userurl', $url );1028 1018 } 1029 1019 … … 1082 1072 return $display_name; 1083 1073 1084 if ( !$url = bp_core_get_user url($user_id) )1074 if ( !$url = bp_core_get_user_domain($user_id) ) 1085 1075 return false; 1086 1076 -
trunk/bp-core/bp-core-classes.php
r2284 r2285 65 65 $this->email = attribute_escape( $this->profile_data['user_email'] ); 66 66 } else { 67 $this->user_url = bp_core_get_user url( $this->id );67 $this->user_url = bp_core_get_user_domain( $this->id ); 68 68 $this->user_link = bp_core_get_userlink( $this->id ); 69 69 $this->fullname = attribute_escape( bp_core_get_user_displayname( $this->id ) ); -
trunk/bp-core/bp-core-templatetags.php
r2284 r2285 1311 1311 } 1312 1312 1313 function bp_displayed_user_username() { 1314 echo bp_get_displayed_user_username(); 1315 } 1316 function bp_get_displayed_user_username() { 1317 global $bp; 1318 return apply_filters( 'bp_get_displayed_user_username', bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ); 1319 } 1320 1321 function bp_loggedin_user_username() { 1322 echo bp_get_loggedin_user_username(); 1323 } 1324 function bp_get_loggedin_user_username() { 1325 global $bp; 1326 return apply_filters( 'bp_get_loggedin_user_username', bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login ) ); 1327 } 1328 1313 1329 function bp_current_component() { 1314 1330 global $bp; -
trunk/bp-friends.php
r2276 r2285 313 313 } else { 314 314 $user_fullname = bp_core_get_user_displayname( $item_id ); 315 $user_url = bp_core_get_ userurl( $item_id );315 $user_url = bp_core_get_domain( $item_id ); 316 316 return apply_filters( 'bp_friends_single_friendship_accepted_notification', '<a href="' . $user_url . '?new" title="' . $user_fullname .'\'s profile">' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname ); 317 317 } … … 323 323 } else { 324 324 $user_fullname = bp_core_get_user_displayname( $item_id ); 325 $user_url = bp_core_get_user url( $item_id );325 $user_url = bp_core_get_user_domain( $item_id ); 326 326 return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname ); 327 327 } … … 419 419 $friend_link = bp_core_get_userlink( $friendship->friend_user_id ); 420 420 421 $primary_link = apply_filters( 'friends_activity_friendship_accepted_primary_link', bp_core_get_user url( $friendship->initiator_user_id ), &$friendship );421 $primary_link = apply_filters( 'friends_activity_friendship_accepted_primary_link', bp_core_get_user_domain( $friendship->initiator_user_id ), &$friendship ); 422 422 423 423 /* Record in activity streams for the initiator */ -
trunk/bp-friends/bp-friends-templatetags.php
r2277 r2285 44 44 <?php for ( $i = 0; $i < count( $friend_ids ); $i++ ) { ?> 45 45 <li> 46 <a href="<?php echo bp_core_get_ userurl( $friend_ids[$i] ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) ) ?></a>46 <a href="<?php echo bp_core_get_domain( $friend_ids[$i] ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) ) ?></a> 47 47 <h5><?php echo bp_core_get_userlink($friend_ids[$i]) ?></h5> 48 48 </li> … … 71 71 <?php for ( $i = 0; $i < count( $user_ids['users'] ); $i++ ) { ?> 72 72 <li> 73 <a href="<?php echo bp_core_get_user url( $user_ids['users'][$i]->user_id ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->user_id, 'type' => 'thumb' ) ) ?></a>73 <a href="<?php echo bp_core_get_user_domain( $user_ids['users'][$i]->user_id ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->user_id, 'type' => 'thumb' ) ) ?></a> 74 74 <h5><?php echo bp_core_get_userlink($user_ids['users'][$i]->user_id) ?></h5> 75 75 <?php if ( function_exists( 'xprofile_get_random_profile_data' ) ) { ?> -
trunk/bp-groups.php
r2270 r2285 1511 1511 1512 1512 $group = new BP_Groups_Group( $group_id, false, false ); 1513 $user_url = bp_core_get_ userurl( $user_id );1513 $user_url = bp_core_get_domain( $user_id ); 1514 1514 1515 1515 if ( (int)$total_items > 1 ) {
Note: See TracChangeset
for help on using the changeset viewer.