Skip to:
Content

BuddyPress.org

Ticket #5099: 5099.02.patch

File 5099.02.patch, 1.0 KB (added by boonebgorges, 13 years ago)
  • bp-groups/bp-groups-classes.php

    diff --git bp-groups/bp-groups-classes.php bp-groups/bp-groups-classes.php
    index f5a0efa..77cd576 100644
    class BP_Groups_Group {  
    465465                        $total_sql['where'][] = $wpdb->prepare( "m.group_id = g.id AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0", $r['user_id'] );
    466466                }
    467467
     468                // Temporary implementation of meta_query for total count
     469                // See #5099
     470                if ( ! empty( $meta_query_sql['where'] ) ) {
     471                        // Join the groupmeta table
     472                        $total_sql['select'] .= ", {$bp->groups->table_name_groupmeta} gmmq";
     473
     474                        // Modify the meta_query clause from paged_sql for our syntax
     475                        $meta_query_clause = preg_replace( '/^\s*AND/', '', $meta_query_sql['where'] );
     476                        $meta_query_clause = str_replace( $bp->groups->table_name_groupmeta, 'gmmq', $meta_query_clause );
     477                        $total_sql['where'][] = $meta_query_clause;
     478                }
     479
    468480                // Already escaped in the paginated results block
    469481                if ( ! empty( $include ) ) {
    470482                        $total_sql['where'][] = "g.id IN ({$include})";