Making WordPress.org

Changeset 2036


Ignore:
Timestamp:
11/03/2015 07:18:51 PM (11 years ago)
Author:
kovshenin
Message:

WordCamp.org: Add search functionality to the payments dashboard.

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

    r2035 r2036  
    4444                ?>
    4545                <style>
     46                #wcp-list-table .search-box {
     47                        margin-top: 12px;
     48                }
     49
    4650                #wcp-list-table .manage-column.column-payment {
    4751                        width: 30%;
    … …  
    6771                $limit = '';
    6872
     73                $per_page = 10;
    6974                $orderby = 'due';
    7075                $order = 'asc';
    … …  
    8287                }
    8388
     89                if ( ! empty( $_REQUEST['s'] ) ) {
     90                        $where .= $wpdb->prepare( " AND `keywords` LIKE %s ", '%' . $wpdb->esc_like( wp_unslash( $_REQUEST['s'] ) ) . '%' );
     91                }
     92
    8493                if ( ! empty( $_REQUEST['orderby'] ) && in_array( $_REQUEST['orderby'], array_values( $this->get_sortable_columns() ) ) )
    8594                        $orderby = $_REQUEST['orderby'];
    … …  
    91100
    92101                $paged = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
    93                 $per_page = 10;
    94102
    95103                $limit .= sprintf( " LIMIT %d OFFSET %d ", $per_page, $per_page * ( $paged - 1 ) );
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/wordcamp-payments-network.php

    r2021 r2036  
    1212class WordCamp_Payments_Network_Tools {
    1313        public static $list_table;
    14         public static $db_version = 4;
     14        public static $db_version = 6;
    1515
    1616        /**
    … …  
    4343        public static function get_table_name() {
    4444                global $wpdb;
    45                 return $wpdb->get_blog_prefix(0) . 'wordcamp_payments_index';
     45                return $wpdb->get_blog_prefix(0) . 'wordcamp_payments_index';
    4646        }
    4747
    … …  
    6868                        post_id int(11) unsigned NOT NULL default '0',
    6969                        created int(11) unsigned NOT NULL default '0',
     70                        paid int(11) unsigned NOT NULL default '0',
    7071                        category varchar(255) NOT NULL default '',
    7172                        method varchar(255) NOT NULL default '',
    7273                        due int(11) unsigned NOT NULL default '0',
    7374                        status varchar(255) NOT NULL default '',
     75                        keywords text NOT NULL default '',
    7476                        PRIMARY KEY  (id),
    7577                        KEY blog_post_id (blog_id, post_id),
    … …  
    124126        public static function prepare_for_index( $request ) {
    125127                $request = get_post( $request );
     128                $categories = WCP_Payment_Request::get_payment_categories();
     129
     130                // All things search.
     131                $keywords = array( $request->post_title );
     132
     133                $category_slug = get_post_meta( $request->ID, '_camppayments_payment_category', true );
     134                if ( ! empty( $categories[ $category_slug ] ) )
     135                        $keywords[] = $categories[ $category_slug ];
     136
     137                $payment_method = get_post_meta( $request->ID, '_camppayments_payment_method', true );
     138                if ( ! empty( $payment_method ) )
     139                        $keywords[] = $payment_method;
    126140
    127141                return array(
    … …  
    133147                        'due' => absint( get_post_meta( $request->ID, '_camppayments_due_by', true ) ),
    134148                        'status' => $request->post_status,
    135                         'method' => get_post_meta( $request->ID, '_camppayments_payment_method', true ),
    136                         'category' => get_post_meta( $request->ID, '_camppayments_payment_category', true ),
     149                        'method' => $payment_method,
     150                        'category' => $category_slug,
     151                        'keywords' => json_encode( $keywords ),
    137152                );
    138153        }
    … …  
    233248                        <form id="posts-filter" action="" method="get">
    234249                                <input type="hidden" name="page" value="wcp-dashboard" />
    235                                 <input type="hidden" name="wcp-section" value="overdue" />
     250                                <input type="hidden" name="wcp-section" value="<?php echo esc_attr( self::get_current_tab() ); ?>" />
     251                                <?php self::$list_table->search_box( __( 'Search Payments', 'wordcamporg' ), 'wcp' ); ?>
    236252                                <?php self::$list_table->display(); ?>
    237253                        </form>
Note: See TracChangeset for help on using the changeset viewer.