diff --git a/includes/admin/post-types/class-sp-admin-meta-boxes.php b/includes/admin/post-types/class-sp-admin-meta-boxes.php
index 8189b3d5..ead64146 100644
--- a/includes/admin/post-types/class-sp-admin-meta-boxes.php
+++ b/includes/admin/post-types/class-sp-admin-meta-boxes.php
@@ -125,6 +125,8 @@ class SP_Admin_Meta_Boxes {
add_meta_box( 'sp_videodiv', __( 'Video', 'sportspress' ), 'SP_Meta_Box_Event_Video::output', 'sp_event', 'side', 'low' );
if ( sizeof( array_filter( sp_array_value( $post_meta, 'sp_team', array() ) ) ) ):
add_meta_box( 'sp_resultsdiv', __( 'Team Results', 'sportspress' ), 'SP_Meta_Box_Event_Results::output', 'sp_event', 'normal', 'high' );
+ endif;
+ if ( sizeof( array_filter( sp_array_value( $post_meta, 'sp_player', array() ) ) ) ):
add_meta_box( 'sp_performancediv', __( 'Player Performance', 'sportspress' ), 'SP_Meta_Box_Event_Performance::output', 'sp_event', 'normal', 'high' );
endif;
add_meta_box( 'sp_editordiv', __( 'Article', 'sportspress' ), 'SP_Meta_Box_Event_Editor::output', 'sp_event', 'normal', 'low' );
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 8c92c4c4..6d871d49 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
@@ -25,7 +25,7 @@ class SP_Meta_Box_Event_Performance {
$i = 0;
foreach ( $teams as $key => $team_id ):
- if ( ! $team_id ) continue;
+ if ( -1 == $team_id ) continue;
// Get results for players in the team
$players = sp_array_between( (array)get_post_meta( $post->ID, 'sp_player', false ), 0, $key );
@@ -33,7 +33,11 @@ class SP_Meta_Box_Event_Performance {
?>
- |
+
+ |
+
@@ -99,7 +105,9 @@ class SP_Meta_Box_Event_Performance {
?>
|
- |
+
+ |
+
@@ -137,10 +145,12 @@ class SP_Meta_Box_Event_Performance {
-
-
-
- |
+
+
+
+
+ |
+
'sp_team',
'name' => 'sp_team[]',
'class' => 'sportspress-pages',
- 'show_option_none' => sprintf( __( '— None —', 'sportspress' ), 'Team' ),
+ 'show_option_none' => __( '— None —', 'sportspress' ),
+ 'show_option_all' => __( '— Individual —', 'sportspress' ),
+ 'values' => 'ID',
'selected' => $team,
);
- wp_dropdown_pages( $args );
+ sp_dropdown_pages( $args );
?>
diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php
index 2d020b03..80440cd0 100644
--- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php
+++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php
@@ -103,6 +103,7 @@ class SP_Meta_Box_Player_Statistics {
'post_type' => 'sp_team',
'name' => 'sp_leagues[' . $league_id . '][' . $div_id . ']',
'show_option_none' => __( '— None —', 'sportspress' ),
+ 'show_option_all' => __( '— Individual —', 'sportspress' ),
'sort_order' => 'ASC',
'sort_column' => 'menu_order',
'selected' => $value,
diff --git a/includes/class-sp-event.php b/includes/class-sp-event.php
index d5ac7cc1..4f47524f 100644
--- a/includes/class-sp-event.php
+++ b/includes/class-sp-event.php
@@ -106,6 +106,13 @@ class SP_Event extends SP_Custom_Post{
endif;
endforeach;
endif;
+
+ // Move individual players to top level of array
+ if ( array_key_exists( 0, $performance ) ) {
+ foreach ( $performance[ 0 ] as $player_id => $player_performance ) {
+ $performance[ $player_id ] = array( $player_id => $player_performance );
+ }
+ }
$performance[0] = $labels;
return $performance;
endif;
diff --git a/includes/class-sp-player.php b/includes/class-sp-player.php
index 37dce7d7..ce9ea682 100644
--- a/includes/class-sp-player.php
+++ b/includes/class-sp-player.php
@@ -281,21 +281,25 @@ class SP_Player extends SP_Custom_Post {
foreach( $placeholders as $season_id => $season_data ):
- if ( ! sp_array_value( $leagues, $season_id, 0 ) )
+ if ( -1 == sp_array_value( $leagues, $season_id, 0 ) )
continue;
$season_name = sp_array_value( $season_names, $season_id, ' ' );
$team_id = sp_array_value( $leagues, $season_id, array() );
- if ( ! $team_id || $team_id == '-1' )
+ if ( -1 == $team_id )
continue;
- $team_name = get_the_title( $team_id );
-
- if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false ):
- $team_permalink = get_permalink( $team_id );
- $team_name = '' . $team_name . '';
+ if ( $team_id ):
+ $team_name = get_the_title( $team_id );
+
+ if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false ):
+ $team_permalink = get_permalink( $team_id );
+ $team_name = '' . $team_name . '';
+ endif;
+ else:
+ $team_name = '—';
endif;
// Add season name to row
diff --git a/templates/event-performance.php b/templates/event-performance.php
index 6468e3cd..95e7221c 100644
--- a/templates/event-performance.php
+++ b/templates/event-performance.php
@@ -51,7 +51,7 @@ if ( is_array( $teams ) ):
endif;
foreach( $teams as $index => $team_id ):
- if ( ! $team_id ) continue;
+ if ( -1 == $team_id ) continue;
// Get results for players in the team
$players = sp_array_between( (array)get_post_meta( $id, 'sp_player', false ), 0, $index );
@@ -61,12 +61,18 @@ if ( is_array( $teams ) ):
$totals = array();
- $data = sp_array_combine( $players, sp_array_value( $performance, $team_id, array() ) );
+ if ( $team_id ) {
+ $data = sp_array_combine( $players, sp_array_value( $performance, $team_id, array() ) );
+ } else {
+ $data = sp_array_value( array_values( $performance ), $index );
+ }
if ( ! $show_team_players && ! $show_staff && ! $show_total ) continue;
?>
-
+
+
+
$id, 'index' => $index ) );
@@ -179,7 +185,7 @@ if ( is_array( $teams ) ):
?>
-
+
<>
' . __( 'Total', 'sportspress' ) . '';
endif;
- $row = $data[0];
+ $row = sp_array_value( $data, 0, array() );
if ( $mode == 'icons' ) echo '| ';
|