Making WordPress.org

Changeset 1660


Ignore:
Timestamp:
06/15/2015 06:25:44 PM (11 years ago)
Author:
iandunn
Message:

WordCamp Payments Dashboard: Get current view from main class.

r31146-core prevents assigning new members to subclasses of WP_List_Table, which caused all items to be displayed on each tab, rather than only the items relevant to the tab.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/class-list-table.php

    r1222 r1660  
    4141
    4242    /**
    43      * This list table can display multiple views which are
    44      * essentially just filters. Use this method to set the appropriate view.
    45      */
    46     public function set_view( $view ) {
    47         $this->view = 'overdue';
    48         if ( in_array( $view, array( 'pending', 'overdue', 'paid' ) ) )
    49             $this->view = $view;
    50     }
    51 
    52     /**
    5343     * Outputs inline CSS to be used with the list table.
    5444     */
     
    7464
    7565        $sql = sprintf( "SELECT SQL_CALC_FOUND_ROWS blog_id, post_id FROM `%s` WHERE 1=1 ", WordCamp_Payments_Network_Tools::get_table_name() );
     66        $view = WordCamp_Payments_Network_Tools::get_current_tab();
    7667        $where = '';
    7768        $orderby = '';
     
    8172        $order = 'desc';
    8273
    83         if ( 'overdue' == $this->view ) {
     74        if ( 'overdue' == $view ) {
    8475            $where .= $wpdb->prepare( " AND `status` = 'unpaid' AND `due` > 0 AND `due` <= %d ", time() );
    8576            $orderby = 'due';
    8677            $order = 'asc';
    87         } elseif ( 'pending' == $this->view ) {
     78        } elseif ( 'pending' == $view ) {
    8879            $where .= " AND `status` = 'unpaid' ";
    89         } elseif ( 'paid' == $this->view ) {
     80        } elseif ( 'paid' == $view ) {
    9081            $where .= " AND `status` = 'paid' ";
    9182        }
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/wordcamp-payments-network.php

    r1223 r1660  
    209209
    210210        self::$list_table = new WordCamp_Payments_Network_List_Table;
    211         self::$list_table->set_view( self::get_current_tab() );
    212211    }
    213212
     
    216215     */
    217216    public static function get_current_tab() {
    218         if ( isset( $_REQUEST['wcp-section'] ) )
    219             return strtolower( $_REQUEST['wcp-section'] );
    220 
    221         return 'overdue';
     217        $tab = 'overdue';
     218
     219        if ( isset( $_REQUEST['wcp-section'] ) && in_array( $_REQUEST['wcp-section'], array( 'pending', 'overdue', 'paid' ) ) ) {
     220            $tab = $_REQUEST['wcp-section'];
     221        }
     222
     223        return $tab;
    222224    }
    223225
Note: See TracChangeset for help on using the changeset viewer.