Merge pull request #264 from kadimi/patch-4
Make sure $leagues is an array of non-empty values
This commit is contained in:
@@ -126,10 +126,10 @@ class SP_Player extends SP_Custom_Post {
|
|||||||
$seasons = (array)get_the_terms( $this->ID, 'sp_season', $args );
|
$seasons = (array)get_the_terms( $this->ID, 'sp_season', $args );
|
||||||
$metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true );
|
$metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true );
|
||||||
$stats = (array)get_post_meta( $this->ID, 'sp_statistics', true );
|
$stats = (array)get_post_meta( $this->ID, 'sp_statistics', true );
|
||||||
$leagues = sp_array_value( (array)get_post_meta( $this->ID, 'sp_leagues', true ), $league_id, array() );
|
$leagues = (array) sp_array_value( (array)get_post_meta( $this->ID, 'sp_leagues', true ), $league_id );
|
||||||
$manual_columns = 'manual' == get_option( 'sportspress_player_columns', 'auto' ) ? true : false;
|
$manual_columns = 'manual' == get_option( 'sportspress_player_columns', 'auto' ) ? true : false;
|
||||||
|
|
||||||
$season_ids = wp_list_pluck( $seasons, 'term_id' );
|
$season_ids = array_filter(wp_list_pluck( $seasons, 'term_id' ));
|
||||||
$season_order = array_flip( $season_ids );
|
$season_order = array_flip( $season_ids );
|
||||||
foreach ( $season_order as $season_id => $val ) {
|
foreach ( $season_order as $season_id => $val ) {
|
||||||
$season_order[ $season_id ] = null;
|
$season_order[ $season_id ] = null;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ $scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'ye
|
|||||||
$show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_total', 'no' ) ? true : false;
|
$show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_total', 'no' ) ? true : false;
|
||||||
$sections = get_option( 'sportspress_player_performance_sections', -1 );
|
$sections = get_option( 'sportspress_player_performance_sections', -1 );
|
||||||
$show_teams = apply_filters( 'sportspress_player_team_statistics', true );
|
$show_teams = apply_filters( 'sportspress_player_team_statistics', true );
|
||||||
$leagues = get_the_terms( $id, 'sp_league' );
|
$leagues = array_filter( ( array ) get_the_terms( $id, 'sp_league' ) );
|
||||||
|
|
||||||
// Sort Leagues by User Defined Order (PHP5.2 supported)
|
// Sort Leagues by User Defined Order (PHP5.2 supported)
|
||||||
foreach ( $leagues as $key => $league ) {
|
foreach ( $leagues as $key => $league ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user