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-messages/bp-messages-template.php

    r5822 r5891  
    3030    var $search_terms;
    3131
    32     function bp_messages_box_template( $user_id, $box, $per_page, $max, $type ) {
    33         $this->__construct( $user_id, $box, $per_page, $max, $type );
    34     }
    35 
    36     function __construct( $user_id, $box, $per_page, $max, $type, $search_terms ) {
    37         $this->pag_page = isset( $_GET['mpage'] ) ? intval( $_GET['mpage'] ) : 1;
     32    function __construct( $user_id, $box, $per_page, $max, $type, $search_terms, $page_arg = 'mpage' ) {
     33        $this->pag_page = isset( $_GET[$page_arg] ) ? intval( $_GET[$page_arg] ) : 1;
    3834        $this->pag_num  = isset( $_GET['num'] )   ? intval( $_GET['num'] )   : $per_page;
    3935
     
    4238        $this->type         = $type;
    4339        $this->search_terms = $search_terms;
    44        
     40
    4541        if ( 'notices' == $this->box ) {
    4642            $this->threads = BP_Messages_Notice::get_notices();
     
    7975        if ( (int) $this->total_thread_count && (int) $this->pag_num ) {
    8076            $this->pag_links = paginate_links( array(
    81                 'base'      => add_query_arg( 'mpage', '%#%' ),
     77                'base'      => add_query_arg( $page_arg, '%#%' ),
    8278                'format'    => '',
    8379                'total'     => ceil( (int) $this->total_thread_count / (int) $this->pag_num ),
     
    176172        'max'          => false,
    177173        'type'         => 'all',
    178         'search_terms' => isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''
     174        'search_terms' => isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '',
     175        'page_arg'     => 'mpage', // See https://buddypress.trac.wordpress.org/ticket/3679
    179176    );
    180177
     
    197194        }
    198195
    199         $messages_template = new BP_Messages_Box_Template( $user_id, $box, $per_page, $max, $type, $search_terms );
     196        $messages_template = new BP_Messages_Box_Template( $user_id, $box, $per_page, $max, $type, $search_terms, $page_arg );
    200197    }
    201198
     
    323320    function bp_get_message_thread_avatar() {
    324321        global $messages_template;
    325        
     322
    326323        return apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array( 'item_id' => $messages_template->thread->last_sender_id, 'type' => 'thumb', 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $messages_template->thread->last_sender_id ) ) ) ) );
    327324    }
Note: See TracChangeset for help on using the changeset viewer.