Skip to:
Content

BuddyPress.org

Changeset 5644


Ignore:
Timestamp:
01/21/2012 11:28:54 AM (12 years ago)
Author:
djpaul
Message:

Update groups loop total_group_count to reflect include/exclude arguments. Fixes #3924

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-classes.php

    r5560 r5644  
    344344            $sql['pagination'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $per_page), intval( $per_page ) );
    345345
    346         /* Get paginated results */
     346        // Get paginated results
    347347        $paged_groups_sql = apply_filters( 'bp_groups_get_paged_groups_sql', join( ' ', (array)$sql ), $sql );
    348348        $paged_groups     = $wpdb->get_results( $paged_groups_sql );
     
    362362            $total_sql['where'][] = "m.group_id = g.id AND m.user_id = {$user_id} AND m.is_confirmed = 1 AND m.is_banned = 0";
    363363
    364         if ( !empty( $exclude ) ) {
    365             $exclude = $wpdb->escape( $exclude );
    366             $total_sql['where'][] = " g.id NOT IN ({$exclude})";
    367         }
     364        // Already escaped in the paginated results block
     365        if ( ! empty( $include ) )
     366            $total_sql['where'][] = "g.id IN ({$include})";
     367
     368        // Already escaped in the paginated results block
     369        if ( ! empty( $exclude ) )
     370            $total_sql['where'][] = "g.id NOT IN ({$exclude})";
    368371
    369372        $total_sql['where'][] = "g.id = gm1.group_id";
Note: See TracChangeset for help on using the changeset viewer.