Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/21/2011 10:27:09 PM (13 years ago)
Author:
djpaul
Message:

Tune up 'for' loops. Fixes #2985, props cnorris23 and r-a-y

File:
1 edited

Legend:

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

    r4398 r4770  
    251251            return $paged_blogs;
    252252
    253         for ( $i = 0; $i < count( $paged_blogs ); $i++ ) {
     253        for ( $i = 0, $count = count( $paged_blogs ); $i < $count; ++$i ) {
    254254            $blog_prefix = $wpdb->get_blog_prefix( $paged_blogs[$i]->blog_id );
    255255            $paged_blogs[$i]->latest_post = $wpdb->get_row( "SELECT post_title, guid FROM {$blog_prefix}posts WHERE post_status = 'publish' AND post_type = 'post' AND id != 1 ORDER BY id DESC LIMIT 1" );
     
    259259        $blog_descs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, meta_value as description FROM {$bp->blogs->table_name_blogmeta} WHERE meta_key = 'description' AND blog_id IN ( {$blog_ids} )" ) );
    260260
    261         for ( $i = 0; $i < count( $paged_blogs ); $i++ ) {
     261        for ( $i = 0, $count = count( $paged_blogs ); $i < $count; ++$i ) {
    262262            foreach ( (array)$blog_descs as $desc ) {
    263263                if ( $desc->blog_id == $paged_blogs[$i]->blog_id )
Note: See TracChangeset for help on using the changeset viewer.