Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/07/2008 07:16:51 AM (18 years ago)
Author:
apeatling
Message:

Bug fixes:

  • Fixed group avatar upload issues
  • Fixed validation on group name/desc/news
  • Fixed support for https://
  • Base support for upcoming home theme and widgets
  • Re-factored JS and CSS inclusion with wp_enqueue_script/styles
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-classes.php

    r309 r373  
    6161                $this->fullname = bp_core_get_userlink( $this->id, true );
    6262                $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') );
    6364               
    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') ) {
    8166                        $this->avatar = bp_core_get_avatar( $this->id, 2 );
    8267                        $this->avatar_thumb = bp_core_get_avatar( $this->id, 1 );
     
    8671                }
    8772               
    88                 if ( BP_STATUSES_IS_INSTALLED ) {
     73                if ( function_exists('bp_statuses_install') ) {
    8974                        $this->status = null; // TODO: Fetch status updates.
    9075                        $this->status_last_updated = null;
    9176                }
    9277        }
     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
    93112}
    94113
Note: See TracChangeset for help on using the changeset viewer.