Changeset 1041
- Timestamp:
- 02/09/2009 09:15:41 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs/bp-blogs-classes.php
r1020 r1041 145 145 if ( $limit && $page ) { 146 146 $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}" ) ); 151 151 152 152 return array( 'blogs' => $paged_blogs, 'total' => $total_blogs ); … … 160 160 if ( $limit && $page ) { 161 161 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 162 $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(b log_id) FROM {$bp->blogs->table_name_blogmeta} WHERE meta_key = 'name' AND meta_value LIKE '$letter%%' ORDER BYmeta_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 BYmeta_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}" ) ); 166 166 167 167 return array( 'blogs' => $paged_blogs, 'total' => $total_blogs ); … … 175 175 if ( $limit && $page ) { 176 176 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 177 $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(b log_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}" ) ); 181 181 182 182 return array( 'blogs' => $paged_blogs, 'total' => $total_blogs );
Note: See TracChangeset
for help on using the changeset viewer.