Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/13/2009 01:01:37 AM (17 years ago)
Author:
apeatling
Message:

Initial support for threaded activity stream commenting. Some major performance improvements around fetching profile and group data.

File:
1 edited

Legend:

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

    r2077 r2088  
    719719        /** Static Functions **/
    720720
     721        /**
     722         * BP_XProfile_ProfileData::get_all_for_user()
     723         *
     724         * Get all of the profile information for a specific user.
     725         */
     726        function get_all_for_user( $user_id ) {
     727                global $wpdb, $bp;
     728
     729                $results = $wpdb->get_results( $wpdb->prepare( "SELECT g.name as field_group_name, f.name as field_name, f.type as field_type, d.value as field_data, u.user_login, u.user_nicename, u.user_email FROM {$bp->profile->table_name_groups} g LEFT JOIN {$bp->profile->table_name_fields} f ON g.id = f.group_id INNER JOIN {$bp->profile->table_name_data} d ON f.id = d.field_id LEFT JOIN {$wpdb->users} u ON d.user_id = u.ID WHERE d.user_id = %d AND d.value != ''", $user_id ) );
     730
     731                if ( $results ) {
     732                        $profile_data['user_login'] = $results[0]->user_login;
     733                        $profile_data['user_nicename'] = $results[0]->user_nicename;
     734                        $profile_data['user_email'] = $results[0]->user_email;
     735
     736                        foreach( (array) $results as $field ) {
     737                                $profile_data[$field->field_name] = array( 'field_group' => $field->field_group_name, 'field_type' => $field->field_type, 'field_data' => $field->field_data );
     738                        }
     739                }
     740
     741                return $profile_data;
     742        }
     743
    721744        function get_value_byid( $field_id, $user_id = null ) {
    722745                global $wpdb, $bp;
Note: See TracChangeset for help on using the changeset viewer.