Changeset 6557 for branches/1.6/bp-activity/bp-activity-classes.php
- Timestamp:
- 12/04/2012 12:03:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.6/bp-activity/bp-activity-classes.php
r6330 r6557 217 217 218 218 if ( !empty( $the_index ) ) { 219 $index_hint_sql = $wpdb->prepare( "USE INDEX ({$the_index})" );219 $index_hint_sql = "USE INDEX ({$the_index})"; 220 220 } else { 221 221 $index_hint_sql = ''; … … 229 229 230 230 $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 ) ); 232 232 } 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 ); 237 237 238 238 $total_activities = $wpdb->get_var( $total_activities_sql ); … … 248 248 $activity_user_ids = implode( ',', array_unique( (array) $activity_user_ids ) ); 249 249 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})" ) ) { 251 251 foreach ( (array) $names as $name ) 252 252 $tmp_names[$name->user_id] = $name->user_fullname; … … 402 402 403 403 // Fetch the activity IDs so we can delete any comments for this activity item 404 $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" ));405 406 if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} {$where_sql}" )) )404 $activity_ids = $wpdb->get_col( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" ); 405 406 if ( !$wpdb->query( "DELETE FROM {$bp->activity->table_name} {$where_sql}" ) ) 407 407 return false; 408 408 … … 425 425 $activity_ids = implode ( ',', array_map( 'absint', explode ( ',', $activity_ids ) ) ); 426 426 427 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" ));427 return $wpdb->query( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" ); 428 428 } 429 429 … … 436 436 $activity_ids = implode ( ',', array_map( 'absint', explode ( ',', $activity_ids ) ) ); 437 437 438 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" ));438 return $wpdb->query( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" ); 439 439 } 440 440 … … 561 561 global $wpdb, $bp; 562 562 563 return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" ));563 return $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" ); 564 564 } 565 565 … … 648 648 global $bp, $wpdb; 649 649 650 return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded DESC LIMIT 1" ));650 return $wpdb->get_var( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded DESC LIMIT 1" ); 651 651 } 652 652
Note: See TracChangeset
for help on using the changeset viewer.