Skip to:
Content

BuddyPress.org

Changeset 7815


Ignore:
Timestamp:
02/06/2014 08:44:06 PM (11 years ago)
Author:
boonebgorges
Message:

Use API function instead of direct query in BP_Activity_Activity::append_user_fullnames()

This allows for better caching.

File:
1 edited

Legend:

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

    r7814 r7815  
    534534        if ( bp_is_active( 'xprofile' ) && ! empty( $activities ) ) {
    535535            $activity_user_ids = wp_list_pluck( $activities, 'user_id' );
    536             $activity_user_ids = implode( ',', wp_parse_id_list( $activity_user_ids ) );
    537536
    538537            if ( ! empty( $activity_user_ids ) ) {
    539                 $bp = buddypress();
    540 
    541                 if ( $names = $wpdb->get_results( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) {
     538                $names = BP_XProfile_ProfileData::get_value_byid( 1, $activity_user_ids );
     539                if ( ! empty( $names ) ) {
    542540
    543541                    $tmp_names = array();
    544542
    545543                    foreach ( (array) $names as $name ) {
    546                         $tmp_names[ $name->user_id ] = $name->user_fullname;
     544                        $tmp_names[ $name->user_id ] = $name->value;
    547545                    }
    548546
Note: See TracChangeset for help on using the changeset viewer.