From 6c4b1e981dc094e47bcc3f6c64890be92092db19 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Wed, 2 May 2018 18:39:41 +1000 Subject: [PATCH] Update modules and hooks --- .../class-sp-meta-box-player-statistics.php | 12 ++++++++++++ includes/class-sp-modules.php | 8 ++++++++ templates/player-statistics.php | 8 +++++++- 3 files changed, 27 insertions(+), 1 deletion(-) 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 247ef847..dd08c0f7 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 @@ -81,6 +81,7 @@ class SP_Meta_Box_Player_Statistics { * Save meta box data */ public static function save( $post_id, $post ) { + do_action( 'sportspress_save_meta_player_statistics', $post_id, $_POST ); update_post_meta( $post_id, 'sp_leagues', sp_array_value( $_POST, 'sp_leagues', array() ) ); update_post_meta( $post_id, 'sp_statistics', sp_array_value( $_POST, 'sp_statistics', array() ) ); } @@ -91,6 +92,7 @@ class SP_Meta_Box_Player_Statistics { public static function table( $id = null, $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $leagues = array(), $has_checkboxes = false, $team_select = false, $formats = array(), $total_types = array() ) { $readonly = false; $teams = array_filter( get_post_meta( $id, 'sp_team', false ) ); + $buffer = apply_filters( 'sportspress_meta_box_player_statistics_table_buffer', array( 'teams' => $teams, 'readonly' => $readonly ), $id ); ?>
@@ -105,6 +107,9 @@ class SP_Meta_Box_Player_Statistics { $label ): if ( $key == 'team' ) continue; ?> + 0 ) { ?> + + @@ -201,6 +206,10 @@ class SP_Meta_Box_Player_Statistics { + $columns, 'data' => $data, 'placeholders' => $placeholders, 'merged' => $merged, 'seasons_teams' => array(), 'has_checkboxes' => $has_checkboxes, 'formats' => $formats, 'total_types' => $total_types, 'buffer' => $buffer ); + list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes, $formats, $total_types, $buffer ) = array_values( apply_filters( 'sportspress_meta_box_player_statistics_collection', $collection, $id, $league_id, $div_id, $value ) ); + ?> $label ): if ( $column == 'team' ) continue; ?> +
+−
diff --git a/includes/class-sp-modules.php b/includes/class-sp-modules.php index 6ede5685..28999782 100644 --- a/includes/class-sp-modules.php +++ b/includes/class-sp-modules.php @@ -106,6 +106,14 @@ class SP_Modules { 'icon' => 'sp-icon-list', 'desc' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ), ), + 'midseason_transfers' => array( + 'label' => __( 'Midseason Transfers', 'sportspress' ), + 'class' => 'SportsPress_Midseason_Transfers', + 'icon' => 'sp-icon-sub', + 'link' => 'https://www.themeboy.com/sportspress-extensions/midseason-transfers/', + 'desc' => __( 'Statistics for players who transferred between teams during a season.', 'sportspress' ), + 'default' => 'yes', + ), 'staff_directories' => array( 'label' => __( 'Directories', 'sportspress' ), 'class' => 'SportsPress_Staff_Directories', diff --git a/templates/player-statistics.php b/templates/player-statistics.php index 5f34c311..4ac175ac 100644 --- a/templates/player-statistics.php +++ b/templates/player-statistics.php @@ -69,11 +69,17 @@ if ( is_array( $leagues ) ): 'data' => $player->data( $league->term_id, false, $section_id ), 'caption' => $caption, 'scrollable' => $scrollable, + 'league_id' => $league->term_id, ); if ( ! $show_teams ) { $args['hide_teams'] = true; } - sp_get_template( 'player-statistics-league.php', $args ); + + if ( has_action( 'sportspress_player_statistics_league_template' ) ) { + do_action( 'sportspress_player_statistics_league_template', $args ); + } else { + sp_get_template( 'player-statistics-league.php', $args ); + } endforeach; if ( $show_career_totals ) {