From 01bd682662b068f814fa5609354880849c74e781 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 29 Nov 2012 09:39:00 -0500 Subject: [PATCH] Fix: Show first report tab & chart logically --- admin/woocommerce-admin-reports.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/admin/woocommerce-admin-reports.php b/admin/woocommerce-admin-reports.php index 655351953b5..a6db4c43b3c 100644 --- a/admin/woocommerce-admin-reports.php +++ b/admin/woocommerce-admin-reports.php @@ -22,9 +22,6 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly */ function woocommerce_reports() { - $current_tab = isset( $_GET['tab'] ) ? sanitize_title( urldecode( $_GET['tab'] ) ) : 'sales'; - $current_chart = isset( $_GET['chart'] ) ? absint( urldecode( $_GET['chart'] ) ) : 0; - $charts = apply_filters( 'woocommerce_reports_charts', array( 'sales' => array( 'title' => __( 'Sales', 'woocommerce' ), @@ -100,6 +97,13 @@ function woocommerce_reports() { ) ) ) ); + + $first_tab = array_keys($charts); + $first_chart = array_keys($charts[$first_tab[0]]['charts']); + + $current_tab = isset( $_GET['tab'] ) ? sanitize_title( urldecode( $_GET['tab'] ) ) : $first_tab[0]; + $current_chart = isset( $_GET['chart'] ) ? absint( urldecode( $_GET['chart'] ) ) : $first_chart[0]; + ?>