Skip to:
Content

Changeset 6498


Ignore:
Timestamp:
11/09/12 13:57:34 (17 months ago)
Author:
djpaul
Message:

Remove more unneeded prepare() calls in bp-activity-classes.php. See #4654

File:
1 edited

Legend:

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

    r6431 r6498  
    217217 
    218218        if ( !empty( $the_index ) ) { 
    219             $index_hint_sql = $wpdb->prepare( "USE INDEX ({$the_index})" ); 
     219            $index_hint_sql = "USE INDEX ({$the_index})"; 
    220220        } else { 
    221221            $index_hint_sql = ''; 
     
    229229 
    230230            $pag_sql    = $wpdb->prepare( "LIMIT %d, %d", absint( ( $page - 1 ) * $per_page ), $per_page ); 
    231             $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', $wpdb->prepare( "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}" ), $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) ); 
     231            $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) ); 
    232232        } else { 
    233             $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', $wpdb->prepare( "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort}" ), $select_sql, $from_sql, $where_sql, $sort ) ); 
    234         } 
    235  
    236         $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', $wpdb->prepare( "SELECT count(a.id) FROM {$bp->activity->table_name} a {$index_hint_sql} {$where_sql} ORDER BY a.date_recorded {$sort}" ), $where_sql, $sort ); 
     233            $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $select_sql, $from_sql, $where_sql, $sort ) ); 
     234        } 
     235 
     236        $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(a.id) FROM {$bp->activity->table_name} a {$index_hint_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $where_sql, $sort ); 
    237237 
    238238        $total_activities = $wpdb->get_var( $total_activities_sql ); 
     
    248248            $activity_user_ids = implode( ',', array_unique( (array) $activity_user_ids ) ); 
    249249            if ( !empty( $activity_user_ids ) ) { 
    250                 if ( $names = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) ) { 
     250                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})" ) ) { 
    251251                    foreach ( (array) $names as $name ) 
    252252                        $tmp_names[$name->user_id] = $name->user_fullname; 
Note: See TracChangeset for help on using the changeset viewer.