Changeset 7048 for trunk/bp-activity/bp-activity-classes.php
- Timestamp:
- 05/09/2013 02:11:57 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-classes.php
r6948 r7048 174 174 if ( $search_terms ) { 175 175 $search_terms = $wpdb->escape( $search_terms ); 176 $where_conditions['search_sql'] = "a.content LIKE '%%" . like_escape( $search_terms) . "%%'";176 $where_conditions['search_sql'] = "a.content LIKE '%%" . esc_sql( like_escape( $search_terms ) ) . "%%'"; 177 177 } 178 178 … … 253 253 254 254 // Get the fullnames of users so we don't have to query in the loop 255 $activity_user_ids = array(); 256 if ( bp_is_active( 'xprofile' ) && $activities ) { 257 foreach ( (array) $activities as $activity ) { 258 if ( (int) $activity->user_id ) 259 $activity_user_ids[] = $activity->user_id; 260 } 261 262 $activity_user_ids = implode( ',', array_unique( (array) $activity_user_ids ) ); 263 if ( !empty( $activity_user_ids ) ) { 255 if ( bp_is_active( 'xprofile' ) && !empty( $activities ) ) { 256 $activity_user_ids = wp_list_pluck( $activities, 'user_id' ); 257 $activity_user_ids = implode( ',', wp_parse_id_list( $activity_user_ids ) ); 258 259 if ( !empty( $activity_user_ids ) ) { 264 260 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})" ) ) { 265 261 foreach ( (array) $names as $name ) … … 374 370 375 371 if ( !empty( $item_id ) ) 376 $where_args[] = $wpdb->prepare( "item_id = % s", $item_id );372 $where_args[] = $wpdb->prepare( "item_id = %d", $item_id ); 377 373 378 374 if ( !empty( $secondary_item_id ) ) 379 $where_args[] = $wpdb->prepare( "secondary_item_id = % s", $secondary_item_id );375 $where_args[] = $wpdb->prepare( "secondary_item_id = %d", $secondary_item_id ); 380 376 381 377 if ( !empty( $action ) ) … … 439 435 440 436 if ( !empty( $item_id ) ) 441 $where_args[] = $wpdb->prepare( "item_id = % s", $item_id );437 $where_args[] = $wpdb->prepare( "item_id = %d", $item_id ); 442 438 443 439 if ( !empty( $secondary_item_id ) ) 444 $where_args[] = $wpdb->prepare( "secondary_item_id = % s", $secondary_item_id );440 $where_args[] = $wpdb->prepare( "secondary_item_id = %d", $secondary_item_id ); 445 441 446 442 if ( !empty( $date_recorded ) ) … … 471 467 } 472 468 473 function delete_activity_item_comments( $activity_ids ) {469 function delete_activity_item_comments( $activity_ids = array() ) { 474 470 global $bp, $wpdb; 475 471 476 if ( is_array( $activity_ids ) ) 477 $activity_ids = implode ( ',', array_map( 'absint', $activity_ids ) ); 478 else 479 $activity_ids = implode ( ',', array_map( 'absint', explode ( ',', $activity_ids ) ) ); 472 $activity_ids = implode( ',', wp_parse_id_list( $activity_ids ) ); 480 473 481 474 return $wpdb->query( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" ); 482 475 } 483 476 484 function delete_activity_meta_entries( $activity_ids ) {477 function delete_activity_meta_entries( $activity_ids = array() ) { 485 478 global $bp, $wpdb; 486 479 487 if ( is_array( $activity_ids ) ) 488 $activity_ids = implode ( ',', array_map( 'absint', $activity_ids ) ); 489 else 490 $activity_ids = implode ( ',', array_map( 'absint', explode ( ',', $activity_ids ) ) ); 480 $activity_ids = implode( ',', wp_parse_id_list( $activity_ids ) ); 491 481 492 482 return $wpdb->query( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" );
Note: See TracChangeset
for help on using the changeset viewer.