Changeset 2088 for trunk/bp-core/bp-core-classes.php
- Timestamp:
- 11/13/2009 01:01:37 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-classes.php
r2077 r2088 57 57 */ 58 58 function populate() { 59 $this->user_url = bp_core_get_userurl( $this->id ); 60 $this->user_link = bp_core_get_userlink( $this->id ); 61 62 $this->fullname = attribute_escape( bp_core_get_user_displayname( $this->id ) ); 63 $this->email = attribute_escape( bp_core_get_user_email( $this->id ) ); 64 $this->last_active = attribute_escape( bp_core_get_last_activity( get_usermeta( $this->id, 'last_activity' ), __( 'active %s ago', 'buddypress' ) ) ); 59 if ( function_exists( 'xprofile_install' ) ) 60 $this->profile_data = $this->get_profile_data(); 61 62 if ( $this->profile_data ) { 63 $this->user_url = bp_core_get_user_domain( $this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login'] ); 64 $this->fullname = attribute_escape( $this->profile_data[BP_XPROFILE_FULLNAME_FIELD_NAME]['field_data'] ); 65 $this->user_link = "<a href='{$this->user_url}'>{$this->fullname}</a>"; 66 $this->email = attribute_escape( $this->profile_data['user_email'] ); 67 } else { 68 $this->user_url = bp_core_get_userurl( $this->id ); 69 $this->user_link = bp_core_get_userlink( $this->id ); 70 $this->fullname = attribute_escape( bp_core_get_user_displayname( $this->id ) ); 71 $this->email = attribute_escape( bp_core_get_user_email( $this->id ) ); 72 } 73 74 /* Cache a few things that are fetched often */ 75 wp_cache_set( 'bp_user_fullname_' . $this->id, $this->fullname, 'bp' ); 76 wp_cache_set( 'bp_user_email_' . $this->id, $this->email, 'bp' ); 77 wp_cache_set( 'bp_user_url_' . $this->id, $this->user_url, 'bp' ); 65 78 66 79 $this->avatar = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'full' ) ); … … 72 85 global $bp; 73 86 74 if ( function_exists('friends_install') ) {87 if ( function_exists('friends_install') ) 75 88 $this->total_friends = BP_Friends_Friendship::total_friend_count( $this->id ); 76 89 77 if ( $this->total_friends ) { 78 if ( 1 == $this->total_friends ) 79 $this->total_friends .= ' ' . __( 'friend', 'buddypress' ); 80 else 81 $this->total_friends .= ' ' . __( 'friends', 'buddypress' ); 82 83 $this->total_friends = '<a href="' . $this->user_url . $bp->friends->slug . '" title="' . sprintf( __( "%s's friend list", 'buddypress' ), $this->fullname ) . '">' . $this->total_friends . '</a>'; 84 } 85 } 86 87 if ( function_exists('bp_blogs_install') ) { 88 if ( $this->total_blogs ) { 89 if ( 1 == $this->total_blogs ) 90 $this->total_blogs .= ' ' . __( 'blog', 'buddypress' ); 91 else 92 $this->total_blogs .= ' ' . __( 'blogs', 'buddypress' ); 93 94 $this->total_blogs = '<a href="' . $this->user_url . $bp->blogs->slug . '" title="' . sprintf( __( "%s's blog list", 'buddypress' ), $this->fullname ) . '">' . $this->total_blogs . '</a>'; 95 } 96 } 97 98 if ( function_exists('groups_install') ) { 90 if ( function_exists('groups_install') ) 99 91 $this->total_groups = BP_Groups_Member::total_group_count( $this->id ); 100 101 if ( $this->total_groups ) { 102 if ( 1 == $this->total_groups ) 103 $this->total_groups .= ' ' . __( 'group', 'buddypress' ); 104 else 105 $this->total_groups .= ' ' . __( 'groups', 'buddypress' ); 106 107 $this->total_groups = '<a href="' . $this->user_url . $bp->groups->slug . '" title="' . sprintf( __( "%s's group list", 'buddypress' ), $this->fullname ) . '">' . $this->total_groups . '</a>'; 108 } 109 } 92 } 93 94 function get_profile_data() { 95 return BP_XProfile_ProfileData::get_all_for_user( $this->id ); 110 96 } 111 97
Note: See TracChangeset
for help on using the changeset viewer.