From 9d6ecf28bda161fc72e0e24b796339c58ac19d00 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Mon, 6 Nov 2017 11:15:25 +1100 Subject: [PATCH] Display checked manual box score columns on new event screen --- .../class-sp-meta-box-event-performance.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php index bab33ee1..be80b134 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php @@ -70,10 +70,14 @@ class SP_Meta_Box_Event_Performance { */ public static function save( $post_id, $post ) { update_post_meta( $post_id, 'sp_players', sp_array_value( $_POST, 'sp_players', array() ) ); - update_post_meta( $post_id, 'sp_columns', sp_array_value( $_POST, 'sp_columns', array() ) ); update_post_meta( $post_id, 'sp_order', sp_array_value( $_POST, 'sp_order', array() ) ); update_post_meta( $post_id, 'sp_timeline', sp_array_value( $_POST, 'sp_timeline', array() ) ); update_post_meta( $post_id, 'sp_stars', sp_array_value( $_POST, 'sp_stars', array() ) ); + + if ( isset( $_POST['sp_columns'] ) ) { + $columns = array_filter( (array) $_POST['sp_columns'] ); + update_post_meta( $post_id, 'sp_columns', $columns ); + } } /** @@ -81,8 +85,9 @@ class SP_Meta_Box_Event_Performance { */ public static function tables( $post_id, $stats = array(), $labels = array(), $columns = array(), $teams = array(), $has_checkboxes = false, $positions = array(), $status = true, $formats = array(), $order = array(), $numbers = true, $is_individual = false, $timeline = array(), $timed = array(), $stars = array() ) { $sections = get_option( 'sportspress_event_performance_sections', -1 ); - - if ( $is_individual ) { + global $pagenow; + + if ( $pagenow === 'post-new.php' || $is_individual ) { ?>
@@ -288,7 +293,7 @@ class SP_Meta_Box_Event_Performance { * Admin edit table header */ public static function header( $columns = array(), $labels = array(), $positions = array(), $has_checkboxes = false, $status = true, $sortable = true, $numbers = true, $section = -1, $formats = array() ) { - $stars_type = get_option( 'sportspress_event_performance_stars_type', 0 ) + $stars_type = get_option( 'sportspress_event_performance_stars_type', 0 ); ?> @@ -304,10 +309,13 @@ class SP_Meta_Box_Event_Performance { - $label ): ?> + $label ): ?> - +
+ + +