Skip to:
Content

BuddyPress.org

Ticket #4018: bp-activity-classes.php.patch

File bp-activity-classes.php.patch, 1.5 KB (added by webraket, 10 years ago)
  • bp-activity-classes.php

     
    104104                global $wpdb, $bp;
    105105
    106106                // Select conditions
    107                 $select_sql = "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";
     107                $select_sql = "SELECT SQL_CALC_FOUND_ROWS a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";
    108108
    109109                $from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID";
    110110
     
    120120                // Searching
    121121                if ( $search_terms ) {
    122122                        $search_terms = $wpdb->escape( $search_terms );
     123                        $where_conditions['search_fulltext_sql'] = "MATCH(`content`) AGAINST('".$search_terms."')";
    123124                        $where_conditions['search_sql'] = "a.content LIKE '%%" . like_escape( $search_terms ) . "%%'";
    124125                }
    125126
     
    165166                        $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 ) );
    166167                }
    167168
    168                 $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', $wpdb->prepare( "SELECT count(a.id) FROM {$bp->activity->table_name} a {$where_sql} ORDER BY a.date_recorded {$sort}" ), $where_sql, $sort );
     169                $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', $wpdb->prepare( "SELECT FOUND_ROWS()" ) );
    169170
    170171                $total_activities = $wpdb->get_var( $total_activities_sql );
    171172