Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/06/2012 07:15:09 AM (13 years ago)
Author:
djpaul
Message:

Allow pagination arguments for template loops to be renamed. Remove PHP4 constructors. Fixes #3679, props r-a-y and cnorris23

File:
1 edited

Legend:

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

    r5729 r5891  
    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 );
    107     }
    108 
    109     function __construct( $type, $page, $per_page, $max, $user_id, $search_terms ) {
    110 
    111         $this->pag_page = isset( $_REQUEST['bpage'] ) ? intval( $_REQUEST['bpage'] ) : $page;
     105    function __construct( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg = 'bpage' ) {
     106
     107        $this->pag_page = isset( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : $page;
    112108        $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
    113109
     
    136132        if ( (int) $this->total_blog_count && (int) $this->pag_num ) {
    137133            $this->pag_links = paginate_links( array(
    138                 'base'      => add_query_arg( 'bpage', '%#%' ),
     134                'base'      => add_query_arg( $page_arg, '%#%' ),
    139135                'format'    => '',
    140136                'total'     => ceil( (int) $this->total_blog_count / (int) $this->pag_num ),
     
    209205    $search_terms = null;
    210206
    211     /* User filtering */
     207    // User filtering
    212208    if ( bp_displayed_user_id() )
    213209        $user_id = bp_displayed_user_id();
     
    219215        'max'          => false,
    220216
    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.
     217        'page_arg'     => 'bpage',        // See https://buddypress.trac.wordpress.org/ticket/3679
     218
     219        'user_id'      => $user_id,       // Pass a user_id to limit to only blogs this user has higher than subscriber access to
     220        'search_terms' => $search_terms   // Pass search terms to filter on the blog title or description.
    223221    );
    224222
     
    239237    }
    240238
    241     $blogs_template = new BP_Blogs_Template( $type, $page, $per_page, $max, $user_id, $search_terms );
     239    $blogs_template = new BP_Blogs_Template( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg );
    242240    return apply_filters( 'bp_has_blogs', $blogs_template->has_blogs(), $blogs_template );
    243241}
     
    280278    function bp_get_blog_avatar( $args = '' ) {
    281279        global $blogs_template;
    282        
     280
    283281        $defaults = array(
    284282            'type'    => 'full',
     
    528526    function bp_blogs_get_subdomain_base() {
    529527        global $current_site;
    530        
     528
    531529        return apply_filters( 'bp_blogs_subdomain_base', preg_replace( '|^www\.|', '', $current_site->domain ) . $current_site->path );
    532530    }
Note: See TracChangeset for help on using the changeset viewer.