bp_blogs_get_blogs

Retrieve a set of blogs.

Description

(array) bp_blogs_get_blogs( (string) $args = '' ); 

Returns (array)

See {@link BP_Blogs_Blog::get()}.

Parameters (1)

0. $args — Optional. (string) => ''
The args.

Options

    ;        


    Usage

    1. if ( !function_exists( 'bp_blogs_get_blogs' ) ) { 
    2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-functions.php'; 
    3.  
    4. // The args. 
    5. $args = ''; 
    6.  
    7. // NOTICE! Understand what this does before running. 
    8. $result = bp_blogs_get_blogs($args); 
    9.  

    Defined (1)

    The function is defined in the following location(s).

    /bp-blogs/bp-blogs-functions.php  
    1. function bp_blogs_get_blogs( $args = '' ) { 
    2.  
    3. // Parse query arguments. 
    4. $r = bp_parse_args( $args, array( 
    5. 'type' => 'active', // 'active', 'alphabetical', 'newest', or 'random' 
    6. 'include_blog_ids' => false, // Array of blog IDs to include 
    7. 'user_id' => false, // Limit to blogs this user can post to 
    8. 'search_terms' => false, // Limit to blogs matching these search terms 
    9. 'per_page' => 20, // The number of results to return per page 
    10. 'page' => 1, // The page to return if limiting per page 
    11. 'update_meta_cache' => true // Whether to pre-fetch blogmeta 
    12. ), 'blogs_get_blogs' ); 
    13.  
    14. // Get the blogs. 
    15. $blogs = BP_Blogs_Blog::get( 
    16. $r['type'],  
    17. $r['per_page'],  
    18. $r['page'],  
    19. $r['user_id'],  
    20. $r['search_terms'],  
    21. $r['update_meta_cache'],  
    22. $r['include_blog_ids'] 
    23. ); 
    24.  
    25. /** 
    26. * Filters a set of blogs. 
    27. * @since 1.2.0 
    28. * @param array $blogs Array of blog data. 
    29. * @param array $r Parsed query arguments. 
    30. */ 
    31. return apply_filters( 'bp_blogs_get_blogs', $blogs, $r );