Ticket #7848: 7848.01.patch
File 7848.01.patch, 2.5 KB (added by , 7 years ago) |
---|
-
src/bp-activity/classes/class-bp-activity-activity.php
613 613 $from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID"; 614 614 615 615 if ( ! empty( $page ) && ! empty( $per_page ) ) { 616 $pag_sql 616 $pag_sql = $wpdb->prepare( "LIMIT %d, %d", absint( ( $page - 1 ) * $per_page ), $per_page ); 617 617 618 618 /** This filter is documented in bp-activity/bp-activity-classes.php */ 619 $activit ies = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}, a.id {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ));619 $activity_sql = apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}, a.id {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ); 620 620 } else { 621 $pag_sql 621 $pag_sql = ''; 622 622 623 623 /** 624 624 * Filters the legacy MySQL query statement so plugins can alter before results are fetched. … … 631 631 * @param string $where_sql Final WHERE MySQL statement portion for legacy query. 632 632 * @param string $sort Final sort direction for legacy query. 633 633 */ 634 $activit ies = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}, a.id {$sort}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ));634 $activity_sql = apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}, a.id {$sort}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ); 635 635 } 636 636 637 /* 638 * Queries that include 'last_activity' are cached separately, 639 * since they are generally much less long-lived. 640 */ 641 if ( preg_match( '/a\.type NOT IN \([^\)]*\'last_activity\'[^\)]*\)/', $activity_sql ) ) { 642 $cache_group = 'bp_activity'; 643 } else { 644 $cache_group = 'bp_activity_with_last_activity'; 645 } 646 647 $activities = $wpdb->get_results( $activity_sql ); 648 637 649 // Integer casting for legacy activity query. 638 650 foreach ( (array) $activities as $i => $ac ) { 639 651 $activities[ $i ]->id = (int) $ac->id;