Changeset 1250 for trunk/bp-blogs/bp-blogs-classes.php
- Timestamp:
- 03/25/2009 04:01:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs/bp-blogs-classes.php
r1238 r1250 220 220 } 221 221 222 function get_active( $limit = null, $page = null ) { 223 global $bp, $wpdb; 224 225 if ( !$bp->blogs ) 226 bp_blogs_setup_globals(); 227 228 if ( $limit && $page ) { 229 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 230 $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" ) ); 231 } 232 233 $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}" ) ); 234 235 return array( 'blogs' => $paged_blogs, 'total' => $total_blogs ); 236 } 237 238 function get_newest( $limit = null, $page = null ) { 239 global $bp, $wpdb; 240 241 if ( !$bp->blogs ) 242 bp_blogs_setup_globals(); 243 244 if ( $limit && $page ) { 245 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 246 $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(wb.blog_id) FROM {$wpdb->base_prefix}blogs wb WHERE wb.public = 1 AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 ORDER BY wb.registered DESC" ) ); 247 } 248 249 $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT wb.blog_id FROM {$wpdb->base_prefix}blogs wb WHERE wb.public = 1 AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 ORDER BY wb.registered DESC {$pag_sql}" ) ); 250 251 return array( 'blogs' => $paged_blogs, 'total' => $total_blogs ); 252 } 253 222 254 function is_hidden( $blog_id ) { 223 255 global $wpdb;
Note: See TracChangeset
for help on using the changeset viewer.