Making WordPress.org


Ignore:
Timestamp:
01/16/2016 12:39:01 AM (9 years ago)
Author:
iandunn
Message:

WordCamp Budgets Dashboard: Fall back to default section if none is requested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/sponsor-invoices-dashboard.php

    r2302 r2304  
    6464    $list_table->prepare_items();
    6565
    66     switch ( $_GET['section'] ) {
     66    switch ( get_current_section() ) {
    6767        case 'submitted':
    6868            $section_explanation = 'These invoices have been completed by the organizer, but need to be approved by a deputy before being sent to the sponsor.';
     
    8282
    8383/**
     84 * Get the current section
     85 *
     86 * @return string
     87 */
     88function get_current_section() {
     89    $sections        = array( 'submitted', 'approved', 'paid' );
     90    $current_section = 'submitted';
     91
     92    if ( isset( $_GET['section'] ) && in_array( $_GET['section'], $sections, true ) ) {
     93        $current_section = $_GET['section'];
     94    }
     95
     96    return $current_section;
     97}
     98
     99/**
    84100 * Get all the data needed to render the section tabs
    85101 *
     
    89105    $statuses        = \WordCamp\Budgets\Sponsor_Invoices\get_custom_statuses();
    90106    $sections        = array();
    91     $current_section = sanitize_text_field( $_GET['section'] );
     107    $current_section = get_current_section();
    92108
    93109    foreach ( $statuses as $status_slug => $status_name ) {
Note: See TracChangeset for help on using the changeset viewer.