Skip to:
Content

BuddyPress.org

Ticket #5272: bp-blogs-functions.php.patch

File bp-blogs-functions.php.patch, 3.3 KB (added by lenasterg, 10 years ago)

P

  • bp-blogs-functions.php

     
    3737 *     @type string|bool $search_terms Default: false.
    3838 *     @type int $per_page Default: 20.
    3939 *     @type int $page Default: 1.
     40 *     @type boolean $show_hidden Default: false.
    4041 * }
    4142 * @return array See {@link BP_Blogs_Blog::get()}.
    4243 */
     
    4849                'search_terms' => false,    // Limit to blogs that match these search terms
    4950                'per_page'     => 20,       // The number of results to return per page
    5051                'page'         => 1,        // The page to return if limiting per page
     52                'show_hidden' => false      // Show also private blogs
    5153        );
    5254
    5355        $params = wp_parse_args( $args, $defaults );
    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        $args_n = array('type' => $type, 'per_page' => $per_page, 'page' => $page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'show_hidden' => $show_hidden);
     59
     60    return apply_filters('bp_blogs_get_blogs', BP_Blogs_Blog::get($args_n), $params);
    5761}
    5862
    5963/**
     
    727731 *
    728732 * @param int $user_id ID of the user being queried. Default: on a user page,
    729733 *        the displayed user. Otherwise, the logged-in user.
     734 * @param bool $show_hidden, count also private blogs of user.
    730735 * @return int $count Total blog count for the user.
    731736 */
    732 function bp_blogs_total_blogs_for_user( $user_id = 0 ) {
     737function bp_blogs_total_blogs_for_user( $user_id = 0, $show_hidden = false) {
    733738
    734739        if ( empty( $user_id ) )
    735740                $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    736741
    737742        if ( !$count = wp_cache_get( 'bp_total_blogs_for_user_' . $user_id, 'bp' ) ) {
    738                 $count = BP_Blogs_Blog::total_blog_count_for_user( $user_id );
     743                $count = BP_Blogs_Blog::total_blog_count_for_user($user_id, $show_hidden);
    739744                wp_cache_set( 'bp_total_blogs_for_user_' . $user_id, $count, 'bp' );
    740745        }
    741746
     
    781786 *
    782787 * @see BP_Blogs_Blog::get_all() for a description of parameters and return values.
    783788 *
    784  * @param int $limit See {@BP_Blogs_Blog::get_all()}.
     789 * @param int $per_page See {@BP_Blogs_Blog::get_all()}.
    785790 * @param int $page See {@BP_Blogs_Blog::get_all()}.
     791 * @param bool $show_hidden See {@BP_Blogs_Blog::get_all()}.
    786792 * @return array See {@BP_Blogs_Blog::get_all()}.
    787793 */
    788 function bp_blogs_get_all_blogs( $limit = null, $page = null ) {
    789         return BP_Blogs_Blog::get_all( $limit, $page );
     794function bp_blogs_get_all_blogs($per_page = null, $page = null, $show_hidden = false) {
     795        return BP_Blogs_Blog::get_all($per_page, $page, $show_hidden);
    790796}
    791797
    792798/**
     
    794800 *
    795801 * @see BP_Blogs_Blog::get() for a description of parameters and return values.
    796802 *
    797  * @param int $limit See {@BP_Blogs_Blog::get()}.
     803 * @param int $per_page See {@BP_Blogs_Blog::get()}.
    798804 * @param int $page See {@BP_Blogs_Blog::get()}.
    799805 * @return array See {@BP_Blogs_Blog::get()}.
    800806 */
    801 function bp_blogs_get_random_blogs( $limit = null, $page = null ) {
    802         return BP_Blogs_Blog::get( 'random', $limit, $page );
     807function bp_blogs_get_random_blogs( $per_page = null, $page = null ) {
     808        $args = array('type' => 'random', 'per_page' => $per_page, 'page' => $page);
     809    return BP_Blogs_Blog::get($args);
    803810}
    804811
    805812/**