Skip to:
Content

BuddyPress.org

Ticket #3679: 3679.blogs.01.diff

File 3679.blogs.01.diff, 3.1 KB (added by cnorris23, 13 years ago)

Blogs

  • bp-blogs/bp-blogs-template.php

     
    102102        var $pag_links;
    103103        var $total_blog_count;
    104104
    105         function bp_blogs_template( $type, $page, $per_page, $max, $user_id, $search_terms ) {
    106                 $this->__construct( $type, $page, $per_page, $max, $user_id, $search_terms );
     105        function bp_blogs_template( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg = 'bpage' ) {
     106                $this->__construct( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg );
    107107        }
    108108
    109         function __construct( $type, $page, $per_page, $max, $user_id, $search_terms ) {
     109        function __construct( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg = 'bpage' ) {
    110110
    111                 $this->pag_page = isset( $_REQUEST['bpage'] ) ? intval( $_REQUEST['bpage'] ) : $page;
     111                $this->pag_page = isset( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : $page;
    112112                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
    113113
    114114                if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] )
     
    135135
    136136                if ( (int) $this->total_blog_count && (int) $this->pag_num ) {
    137137                        $this->pag_links = paginate_links( array(
    138                                 'base'      => add_query_arg( 'bpage', '%#%' ),
     138                                'base'      => add_query_arg( $page_arg, '%#%' ),
    139139                                'format'    => '',
    140140                                'total'     => ceil( (int) $this->total_blog_count / (int) $this->pag_num ),
    141141                                'current'   => (int) $this->pag_page,
     
    208208        $user_id      = 0;
    209209        $search_terms = null;
    210210
    211         /* User filtering */
     211        // User filtering
    212212        if ( bp_displayed_user_id() )
    213213                $user_id = bp_displayed_user_id();
    214214
     
    218218                'per_page'     => 20,
    219219                'max'          => false,
    220220
    221                 'user_id'      => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to
    222                 'search_terms' => $search_terms // Pass search terms to filter on the blog title or description.
     221                'page_arg'     => 'bpage',        // See https://buddypress.trac.wordpress.org/ticket/3679
     222
     223                'user_id'      => $user_id,       // Pass a user_id to limit to only blogs this user has higher than subscriber access to
     224                'search_terms' => $search_terms   // Pass search terms to filter on the blog title or description.
    223225        );
    224226
    225227        $r = wp_parse_args( $args, $defaults );
     
    238240                }
    239241        }
    240242
    241         $blogs_template = new BP_Blogs_Template( $type, $page, $per_page, $max, $user_id, $search_terms );
     243        $blogs_template = new BP_Blogs_Template( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg );
    242244        return apply_filters( 'bp_has_blogs', $blogs_template->has_blogs(), $blogs_template );
    243245}
    244246
     
    279281}
    280282        function bp_get_blog_avatar( $args = '' ) {
    281283                global $blogs_template;
    282                
     284
    283285                $defaults = array(
    284286                        'type'    => 'full',
    285287                        'width'   => false,
     
    527529         */
    528530        function bp_blogs_get_subdomain_base() {
    529531                global $current_site;
    530                
     532
    531533                return apply_filters( 'bp_blogs_subdomain_base', preg_replace( '|^www\.|', '', $current_site->domain ) . $current_site->path );
    532534        }
    533535