Skip to:
Content

bbPress.org

Changeset 2452


Ignore:
Timestamp:
06/30/2010 05:19:16 AM (16 years ago)
Author:
chrishajer
Message:

Fix for incorrect order of posts and for posts being displayed twice. Fixes #1301. Props Nightgunner5

Location:
trunk/bb-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-includes/functions.bb-meta.php

    r2451 r2452  
    298298            break;
    299299        case 'version':
    300             return '1.1-alpha-2451'; // Don't filter
     300            return '1.1-alpha-2452'; // Don't filter
    301301            break;
    302302        case 'bb_db_version' :
  • trunk/bb-includes/functions.bb-posts.php

    r2419 r2452  
    204204                wp_cache_add( $_query_post->post_id, $_query_post, 'bb_post' );
    205205            }
     206        } else {
     207            $_query_posts = array();
    206208        }
    207209    } else {
     
    209211    }
    210212
    211     return array_merge( $_cached_posts, $_query_posts );
     213    $the_posts = array_merge( $_cached_posts, $_query_posts );
     214
     215    usort( $the_posts, '_bb_cache_posts_sort' );
     216    if ( isset( $_query ) && strpos( $_query, 'DESC' ) !== false )
     217        $the_posts = array_reverse( $the_posts );
     218
     219    return $the_posts;
     220}
     221
     222function _bb_cache_posts_sort( $a, $b ) {
     223    return (int) $a->post_id - (int) $b->post_id;
    212224}
    213225
Note: See TracChangeset for help on using the changeset viewer.