Skip to:
Content

BuddyPress.org

Changeset 1041


Ignore:
Timestamp:
02/09/2009 09:15:41 PM (16 years ago)
Author:
apeatling
Message:

Fixes #461

File:
1 edited

Legend:

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

    r1020 r1041  
    145145        if ( $limit && $page ) {
    146146            $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    147             $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(b.blog_id) FROM " . $bp->blogs->table_name . " b LEFT JOIN {$bp->blogs->table_name_blogmeta} bm ON b.blog_id = bm.blog_id LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 AND bm.meta_key = 'last_activity' ORDER BY CONVERT(bm.meta_value, SIGNED) DESC" ) );
    148         }
    149            
    150         $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT b.blog_id FROM " . $bp->blogs->table_name . " b LEFT JOIN {$bp->blogs->table_name_blogmeta} bm ON b.blog_id = bm.blog_id LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 AND bm.meta_key = 'last_activity' ORDER BY CONVERT(bm.meta_value, SIGNED) DESC {$pag_sql}" ) );
     147            $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(bm.blog_id) FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 AND bm.meta_key = 'last_activity' ORDER BY CONVERT(bm.meta_value, SIGNED) DESC" ) );
     148        }
     149           
     150        $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT bm.blog_id FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 AND bm.meta_key = 'last_activity' ORDER BY CONVERT(bm.meta_value, SIGNED) DESC {$pag_sql}" ) );
    151151
    152152        return array( 'blogs' => $paged_blogs, 'total' => $total_blogs );
     
    160160        if ( $limit && $page ) {
    161161            $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    162             $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(blog_id) FROM {$bp->blogs->table_name_blogmeta} WHERE meta_key = 'name' AND meta_value LIKE '$letter%%' ORDER BY meta_value ASC" ) );
    163         }
    164    
    165         $paged_blogs = $wpdb->get_results(  $wpdb->prepare( "SELECT DISTINCT blog_id FROM {$bp->blogs->table_name_blogmeta} WHERE meta_key = 'name' AND meta_value LIKE '$letter%%' ORDER BY meta_value ASC{$pag_sql}" ) );
     162            $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(bm.blog_id) FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE bm.meta_key = 'name' AND bm.meta_value LIKE '$letter%%' AND wb.public = 1 AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY bm.meta_value ASC" ) );
     163        }
     164   
     165        $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT bm.blog_id FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE bm.meta_key = 'name' AND bm.meta_value LIKE '$letter%%' AND wb.public = 1 AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY bm.meta_value ASC{$pag_sql}" ) );
    166166       
    167167        return array( 'blogs' => $paged_blogs, 'total' => $total_blogs );       
     
    175175        if ( $limit && $page ) {
    176176            $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    177             $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(blog_id) FROM {$bp->blogs->table_name_blogmeta} WHERE ( meta_key = 'name' OR meta_key = 'description' ) AND meta_value LIKE '%%$filter%%' ORDER BY meta_value ASC" ) );
    178         }
    179 
    180         $paged_blogs = $wpdb->get_results(  $wpdb->prepare( "SELECT DISTINCT blog_id FROM {$bp->blogs->table_name_blogmeta} WHERE ( meta_key = 'name' OR meta_key = 'description' ) AND meta_value LIKE '%%$filter%%' ORDER BY meta_value ASC{$pag_sql}" ) );
     177            $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(bm.blog_id) FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE ( ( bm.meta_key = 'name' OR bm.meta_key = 'description' ) AND bm.meta_value LIKE '%%$filter%%' ) AND wb.public = 1 AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY meta_value ASC" ) );
     178        }
     179
     180        $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT bm.blog_id FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE ( ( bm.meta_key = 'name' OR bm.meta_key = 'description' ) AND bm.meta_value LIKE '%%$filter%%' ) AND wb.public = 1 AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY meta_value ASC{$pag_sql}" ) );
    181181       
    182182        return array( 'blogs' => $paged_blogs, 'total' => $total_blogs );       
Note: See TracChangeset for help on using the changeset viewer.