Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/06/2014 07:10:30 PM (12 years ago)
Author:
boonebgorges
Message:

Use API function rather than direct SQL query in bp_xprofile_filter_user_query_populate_extras()

Using BP_XProfile_ProfileData::get_value_byid() means cutting down on our
overall number of direct SQL queries, and has the additional benefit of
inheriting the object caching implemented there.

File:
1 edited

Legend:

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

    r7764 r7810  
    253253
    254254    $fullname_field_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s", bp_xprofile_fullname_field_name() ) );
    255     $user_id_names     = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value as fullname FROM {$bp->profile->table_name_data} WHERE user_id IN ({$user_ids_sql}) AND field_id = %d", $fullname_field_id ) );
     255    $user_id_names     = BP_XProfile_ProfileData::get_value_byid( $fullname_field_id, $user_query->user_ids );
    256256
    257257    // Loop through names and override each user's fullname
    258258    foreach ( $user_id_names as $user ) {
    259259        if ( isset( $user_query->results[ $user->user_id ] ) ) {
    260             $user_query->results[ $user->user_id ]->fullname = $user->fullname;
     260            $user_query->results[ $user->user_id ]->fullname = $user->value;
    261261        }
    262262    }
Note: See TracChangeset for help on using the changeset viewer.