Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/18/2014 12:50:11 PM (8 years ago)
Author:
boonebgorges
Message:

Pre-fetch blogmeta when in blog loops

This reduces overhead when querying for blog meta in the context of a
bp_has_blogs() template loop. Mirrors similar functionality in the activity,
groups, and xprofile components.

Also introduces an update_meta_cache parameter to the bp_has_blogs() stack, so
that plugin/theme authors can disable this pre-fetching.

Fixes #5398

File:
1 edited

Legend:

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

    r7885 r7918  
    3838 *     @type int $per_page Default: 20.
    3939 *     @type int $page Default: 1.
     40 *     @type bool $update_meta_cache Whether to pre-fetch blogmeta. Default: true.
    4041 * }
    4142 * @return array See {@link BP_Blogs_Blog::get()}.
     
    4950        'per_page'     => 20,       // The number of results to return per page
    5051        'page'         => 1,        // The page to return if limiting per page
     52        'update_meta_cache' => true,
    5153    );
    5254
     
    5456    extract( $params, EXTR_SKIP );
    5557
    56     return apply_filters( 'bp_blogs_get_blogs', BP_Blogs_Blog::get( $type, $per_page, $page, $user_id, $search_terms ), $params );
     58    return apply_filters( 'bp_blogs_get_blogs', BP_Blogs_Blog::get( $type, $per_page, $page, $user_id, $search_terms, $update_meta_cache ), $params );
    5759}
    5860
Note: See TracChangeset for help on using the changeset viewer.