Changeset 373 for trunk/bp-core/bp-core-classes.php
- Timestamp:
- 10/07/2008 07:16:51 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-classes.php
r309 r373 61 61 $this->fullname = bp_core_get_userlink( $this->id, true ); 62 62 $this->email = bp_core_get_user_email( $this->id ); 63 $this->last_active = bp_core_get_last_activity( get_usermeta( $this->id, 'last_activity' ), __('active '), __(' ago') ); 63 64 64 $last_activity = get_usermeta( $this->id, 'last_activity' ); 65 66 if ( !$last_activity || $last_activity == '' ) { 67 $this->last_active = __('not recently active'); 68 } else { 69 $this->last_active = __('active '); 70 71 if ( strstr( $last_activity, '-' ) ) { 72 $this->last_active .= bp_core_time_since( strtotime( get_usermeta( $this->id, 'last_activity' ) ) ); 73 } else { 74 $this->last_active .= bp_core_time_since( get_usermeta( $this->id, 'last_activity' ) ); 75 } 76 77 $this->last_active .= __(' ago'); 78 } 79 80 if ( BP_XPROFILE_IS_INSTALLED ) { 65 if ( function_exists('xprofile_install') ) { 81 66 $this->avatar = bp_core_get_avatar( $this->id, 2 ); 82 67 $this->avatar_thumb = bp_core_get_avatar( $this->id, 1 ); … … 86 71 } 87 72 88 if ( BP_STATUSES_IS_INSTALLED) {73 if ( function_exists('bp_statuses_install') ) { 89 74 $this->status = null; // TODO: Fetch status updates. 90 75 $this->status_last_updated = null; 91 76 } 92 77 } 78 79 /* Static Functions */ 80 81 function get_newest_users( $limit = 5 ) { 82 global $wpdb; 83 84 if ( !$limit ) 85 $limit = 5; 86 87 return $wpdb->get_results( $wpdb->prepare( "SELECT ID as user_id, user_registered FROM {$wpdb->base_prefix}users WHERE spam = 0 AND deleted = 0 AND user_status = 0 ORDER BY user_registered DESC LIMIT %d", $limit ) ); 88 } 89 90 function get_active_users( $limit = 5 ) { 91 global $wpdb; 92 93 if ( !$limit ) 94 $limit = 5; 95 96 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$wpdb->base_prefix}usermeta um WHERE meta_key = 'last_activity' ORDER BY meta_value ASC LIMIT %d", $limit ) ); 97 } 98 99 function get_popular_users( $limit = 5 ) { 100 global $wpdb; 101 102 if ( !function_exists('friends_install') ) 103 return false; 104 105 if ( !$limit ) 106 $limit = 5; 107 108 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$wpdb->base_prefix}usermeta um WHERE meta_key = 'total_friend_count' ORDER BY meta_value DESC LIMIT %d", $limit ) ); 109 110 } 111 93 112 } 94 113
Note: See TracChangeset
for help on using the changeset viewer.