Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/10/2010 08:12:08 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Clean-up pagination in all components. Fixes #2625. Props BenFremer on your first trac ticket!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-core/bp-core-templatetags.php

    r3238 r3245  
    2222
    2323        $this->pag_page = isset( $_REQUEST['upage'] ) ? intval( $_REQUEST['upage'] ) : $page_number;
    24         $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
    25         $this->type = $type;
    26 
    27         if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] ) {
     24        $this->pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
     25        $this->type     = $type;
     26
     27        if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] )
    2828            $this->members = BP_Core_User::get_users_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras );
    29         } else {
     29        else
    3030            $this->members = bp_core_get_users( array( 'type' => $this->type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'include' => $include, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras ) );
    31         }
    3231
    3332        if ( !$max || $max >= (int)$this->members['total'] )
     
    3938
    4039        if ( $max ) {
    41             if ( $max >= count($this->members) )
    42                 $this->member_count = count($this->members);
    43             else
     40            if ( $max >= count($this->members) ) {
     41                $this->member_count = count( $this->members );
     42            } else {
    4443                $this->member_count = (int)$max;
     44            }
    4545        } else {
    46             $this->member_count = count($this->members);
     46            $this->member_count = count( $this->members );
    4747        }
    4848
    49         if ( (int) $this->total_member_count && (int) $this->pag_num ) {
     49        if ( (int)$this->total_member_count && (int)$this->pag_num ) {
    5050            $this->pag_links = paginate_links( array(
    51                 'base' => add_query_arg( 'upage', '%#%' ),
    52                 'format' => '',
    53                 'total' => ceil( (int) $this->total_member_count / (int) $this->pag_num ),
    54                 'current' => (int) $this->pag_page,
     51                'base'      => add_query_arg( 'upage', '%#%' ),
     52                'format'    => '',
     53                'total'     => ceil( (int)$this->total_member_count / (int)$this->pag_num ),
     54                'current'   => (int)$this->pag_page,
    5555                'prev_text' => '←',
    5656                'next_text' => '→',
    57                 'mid_size' => 1
    58             ));
     57                'mid_size'  => 1
     58            ) );
    5959        }
    6060    }
Note: See TracChangeset for help on using the changeset viewer.