Merge pull request #370 from kadimi/patch-27

Fix players in player checkboxes
This commit is contained in:
Brian Miyaji
2020-04-09 22:39:03 +10:00
committed by GitHub

View File

@@ -159,7 +159,16 @@ class SP_Meta_Box_List_Details {
</p>
<?php
if ( 'manual' == $select ) {
sp_post_checklist( $post->ID, 'sp_player', ( 'auto' == $select ? 'none' : 'block' ), array( 'sp_league', 'sp_season', 'sp_current_team' ) );
$player_filters = array( 'sp_league', 'sp_season' );
if ( $team_id ) {
if ( in_array( $era, [ 'all', 'past' ] ) ) {
$player_filters[] = 'sp_past_team';
}
if ( in_array( $era, [ 'all', 'current' ] ) ) {
$player_filters[] = 'sp_current_team';
}
}
sp_post_checklist( $post->ID, 'sp_player', ( 'auto' == $select ? 'none' : 'block' ), $player_filters );
sp_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) );
} else {
?>