apply_filters( 'sports_bench_player_stats_table', $html, $player, $sport, $seasons )

Type

Filters

Section

Players

Outputs the HTML player’s career stats table

Parameters

  • $html, string, the current HTML for the player stats table
  • $player, Sports_Bench_Player object, the player object for the player
  • $sport, string, the sport that's being used on the site
  • $seasons, array, the stats for the player

Returns

  • string, the HTML for the player's career stats table

Since: 1.5

Source: baseball-player-info.php, line 106; basketball-player-info.php, line 78; football-player-info.php, line 61; hockey-player-info.php, line 79; rugby-player-info.php, line 27; soccer-game-info.php, line 66; volleyball-player-info.php, line 51

Example

/**
 * Returns the html for the player stats table
 *
 * @param string $html
 *
 * @param Sports_Bench_Player $player
 *
 * @param string $sport
 *
 * @param array $seasons
 *
 * @return string, html for player stats table
 *
 * @since 1.5
 */
function sports_bench_do_player_stats_table( $html, $player, $sport, $seasons ) {
	if ( 'baseball' == $sport ) {
		if ( sports_bench_stat_exists( $seasons, 'AB' ) ) {
			$html .= '';
			$html .= '';
			$table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player );
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			foreach ( $seasons as $season ) {
				$season_team = new Sports_Bench_Team( (int) $season->game_team_id );
				if ( $season->AB == 0 ) {
					$batting_average = '.000';
				} else {
					$batting_average = sports_bench_get_batting_average( $season->AB, $season->HITS );
				}
				$table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player );
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
			}
			$html .= '';
			$html .= '
' . __( 'Career Batting Stats', 'sports-bench' ) . '' . __( 'AB', 'sports-bench' ) . '' . __( 'AVG', 'sports-bench' ) . '' . __( 'H', 'sports-bench' ) . '' . __( 'R', 'sports-bench' ) . '' . __( 'RBI', 'sports-bench' ) . '' . __( '2B', 'sports-bench' ) . '' . __( '3B', 'sports-bench' ) . '' . __( 'HR', 'sports-bench' ) . '' . __( 'SO', 'sports-bench' ) . '' . __( 'BB', 'sports-bench' ) . '' . __( 'HBP', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $season->AB . '' . $batting_average . '' . $season->HITS . '' . $season->RUNS . '' . $season->RBI . '' . $season->DOUBLES . '' . $season->TRIPLES . '' . $season->HOMERUNS . '' . $season->STRIKEOUTS . '' . $season->WALKS . '' . $season->HIT_BY_PITCH . '
'; } if ( sports_bench_stat_exists( $seasons, 'PC' ) ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $seasons as $season ) { $season_team = new Sports_Bench_Team( (int) $season->game_team_id ); $record = sports_bench_get_pitcher_record( (int)$season->player_id, '"' . $season->game_season . '"' ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Career Pitching Stats', 'sports-bench' ) . '' . __( 'W-L', 'sports-bench' ) . '' . __( 'SV', 'sports-bench' ) . '' . __( 'IP', 'sports-bench' ) . '' . __( 'ERA', 'sports-bench' ) . '' . __( 'R', 'sports-bench' ) . '' . __( 'ER', 'sports-bench' ) . '' . __( 'H', 'sports-bench' ) . '' . __( 'K', 'sports-bench' ) . '' . __( 'BB', 'sports-bench' ) . '' . __( 'HPB', 'sports-bench' ) . '' . __( 'HR', 'sports-bench' ) . '' . __( 'PC', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $record[ 'wins' ] . '-' . $record[ 'losses' ] . '' . sports_bench_get_pitcher_saves( (int)$season->player_id, '"' . $season->game_season . '"' ) . '' . $season->IP . '' . sports_bench_get_ERA( (int) $season->ER, (int) $season->IP, 9 ) . '' . $season->RA . '' . $season->ER . '' . $season->HA . '' . $season->KS . '' . $season->BB . '' . $season->HPB . '' . $season->HRA . '' . $season->PC . '
'; } $html .= '

' . sports_bench_show_stats_abbreviation_guide() . '

'; } elseif ( 'basketball' == $sport ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; global $wpdb; $player_table = $wpdb->prefix . 'sb_players'; $game_stats_table = $wpdb->prefix . 'sb_game_stats'; $game_table = $wpdb->prefix . 'sb_games'; $player_id = $player->player_id; $querystr = "SELECT p.player_id, p.player_first_name, p.player_last_name, p.team_id, game.game_id, game.game_season, g.game_id, g.game_team_id, g.game_player_id, SUM( g.game_player_started ) as STARTS, COUNT( g.game_player_minutes ) as GP, SUM( g.game_player_minutes ) as MIN, SUM( g.game_player_fgm ) as FGM, SUM( g.game_player_fga ) as FGA, SUM( g.game_player_3pm ) as TPM, SUM( g.game_player_3pa ) as TPA, SUM( g.game_player_ftm ) as FTM, SUM( g.game_player_fta ) as FTA, SUM( g.game_player_points ) as PTS, SUM( g.game_player_off_rebound ) as OFF_REB, SUM( g.game_player_def_rebound ) as DEF_REB, SUM( g.game_player_assists ) as ASSISTS, SUM( g.game_player_steals) as STEALS, SUM( g.game_player_blocks ) as BLOCKS, SUM( g.game_player_to) as TURNOVERS, SUM( g.game_player_plus_minus ) as PM FROM $player_table as p LEFT JOIN $game_stats_table as g ON p.player_id = g.game_player_id LEFT JOIN $game_table as game ON game.game_id = g.game_id WHERE g.game_player_id = $player_id AND game.game_status = 'final' GROUP BY g.game_player_id, game.game_season, g.game_team_id;"; $seasons = $wpdb->get_results( $querystr ); foreach( $seasons as $season ) { $season_team = new Sports_Bench_Team( (int)$season->game_team_id ); if ( strlen( $season->MIN ) > 4 ) { $seconds = substr( $season->MIN, -2, 2 ); $time = substr_replace( $season->MIN, '', -2, 2 ); $minutes = substr( $time, -2, 2 ); $time = substr_replace( $time, '', -2, 2 ); $times = array( $time, $minutes, $seconds ); $time = implode( ':', $times ); } else { $seconds = substr( $season->MIN, -2, 2 ); $minutes = substr_replace( $season->MIN, '', -2, 2 ); $times = array( $minutes, $seconds ); $time = implode( ':', $times ); } $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'REBOUNDS', 'sports-bench' ) . '
' . __( 'GP', 'sports-bench' ) . '' . __( 'ST', 'sports-bench' ) . '' . __( 'MIN', 'sports-bench' ) . '' . __( 'FG', 'sports-bench' ) . '' . __( '3-PT', 'sports-bench' ) . '' . __( 'FT', 'sports-bench' ) . '' . __( 'PTS', 'sports-bench' ) . '' . __( 'AVG', 'sports-bench' ) . '' . __( 'O-D', 'sports-bench' ) . '' . __( 'TOT', 'sports-bench' ) . '' . __( 'REB', 'sports-bench' ) . '' . __( 'A', 'sports-bench' ) . '' . __( 'S', 'sports-bench' ) . '' . __( 'B', 'sports-bench' ) . '' . __( 'TO', 'sports-bench' ) . '' . __( '+/-', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $season->GP . '' . $season->STARTS . '' . $time . '' . $season->FGM . '-' . $season->FGA . '' . $season->TPM . '-' . $season->TPA . '' . $season->FTM . '-' . $season->FTA . '' . $season->PTS . '' . sports_bench_get_points_average( $season->PTS, $season->GP ) . '' . $season->OFF_REB . '-' . $season->DEF_REB . '' . ( $season->OFF_REB + $season->DEF_REB ) . '' . $season->ASSISTS . '' . $season->STEALS . '' . $season->BLOCKS . '' . $season->TURNOVERS . '' . $season->PM . '
'; $html .= '

' . sports_bench_show_stats_abbreviation_guide() . '

'; } elseif ( 'football' == $sport ) { if ( sports_bench_stat_exists( $seasons, 'ATT' ) ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $seasons as $season ) { $season_team = new Sports_Bench_Team( (int) $season->game_team_id ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Career Passing Stats', 'sports-bench' ) . '' . __( 'COMP', 'sports-bench' ) . '' . __( 'ATT', 'sports-bench' ) . '' . __( 'YARDS', 'sports-bench' ) . '' . __( 'TD', 'sports-bench' ) . '' . __( 'INT', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $season->COMP . '' . $season->ATT . '' . $season->PASS_YD . '' . $season->PASS_TD . '' . $season->PASS_INT . '
'; } if ( sports_bench_stat_exists( $seasons, 'RUSHES' ) ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $seasons as $season ) { $season_team = new Sports_Bench_Team( (int) $season->game_team_id ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Career Rushing Stats', 'sports-bench' ) . '' . __( 'RUSHES', 'sports-bench' ) . '' . __( 'YARDS', 'sports-bench' ) . '' . __( 'TDS', 'sports-bench' ) . '' . __( 'FUMBLES', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $season->RUSHES . '' . $season->RUSH_YARDS . '' . $season->RUSH_TD . '' . $season->RUSH_FUM . '
'; } if ( sports_bench_stat_exists( $seasons, 'CATCHES' ) ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $seasons as $season ) { $season_team = new Sports_Bench_Team( (int) $season->game_team_id ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Career Receiving Stats', 'sports-bench' ) . '' . __( 'CATCHES', 'sports-bench' ) . '' . __( 'YARDS', 'sports-bench' ) . '' . __( 'TDS', 'sports-bench' ) . '' . __( 'FUMBLES', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $season->CATCHES . '' . $season->RECEIVE_YARDS . '' . $season->RECEIVE_TD . '' . $season->RECEIVE_FUM . '
'; } if ( sports_bench_stat_exists( $seasons, 'TACKLES' ) or sports_bench_stat_exists( $seasons, 'INTS' ) or sports_bench_stat_exists( $seasons, 'FF' ) or sports_bench_stat_exists( $seasons, 'FR' ) or sports_bench_stat_exists( $seasons, 'BLOCKED' ) ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $seasons as $season ) { $season_team = new Sports_Bench_Team( (int) $season->game_team_id ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Career Defensive Stats', 'sports-bench' ) . '' . __( 'TCK', 'sports-bench' ) . '' . __( 'TFL', 'sports-bench' ) . '' . __( 'SACKS', 'sports-bench' ) . '' . __( 'INTS', 'sports-bench' ) . '' . __( 'TDS', 'sports-bench' ) . '' . __( 'FF', 'sports-bench' ) . '' . __( 'FR', 'sports-bench' ) . '' . __( 'BLK', 'sports-bench' ) . '' . __( 'YDS', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $season->TACKLES . '' . $season->TFL . '' . $season->SACKS . '' . $season->INTS . '' . $season->TDS . '' . $season->FF . '' . $season->FR . '' . $season->BLOCKED . '' . $season->YARDS . '
'; } if ( sports_bench_stat_exists( $seasons, 'FGA' ) or sports_bench_stat_exists( $seasons, 'XPA' ) ) { $html .= ''; $html .= ''; $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $seasons as $season ) { $season_team = new Sports_Bench_Team( (int) $season->game_team_id ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Career Passing Stats', 'sports-bench' ) . '' . __( 'FGM', 'sports-bench' ) . '' . __( 'FGA', 'sports-bench' ) . '' . __( 'XPM', 'sports-bench' ) . '' . __( 'XPA', 'sports-bench' ) . '' . __( 'TOUCHBACKS', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $season->FGM . '' . $season->FGA . '' . $season->XPM . '' . $season->XPA . '' . $season->TB . '
'; } if ( sports_bench_stat_exists( $seasons, 'RETURNS' ) ) { $html .= ''; $html .= ''; $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $seasons as $season ) { $season_team = new Sports_Bench_Team( (int) $season->game_team_id ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Career Receiving Stats', 'sports-bench' ) . '' . __( 'RETURNS', 'sports-bench' ) . '' . __( 'YARDS', 'sports-bench' ) . '' . __( 'TDS', 'sports-bench' ) . '' . __( 'FUMBLES', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $season->RETURNS . '' . $season->RETURN_YARDS . '' . $season->RETURN_TDS . '' . $season->RETURN_FUMBLES . '
'; } $html .= '

' . sports_bench_show_stats_abbreviation_guide() . '

'; } elseif ( 'hockey' == $sport ) { if ( sports_bench_stat_exists( $player, 'GOALS' ) or sports_bench_stat_exists( $player, 'ASSISTS' ) or sports_bench_stat_exists( $player, 'PM' ) or sports_bench_stat_exists( $player, 'SOG' ) or sports_bench_stat_exists( $player, 'PEN' ) or sports_bench_stat_exists( $player, 'PEN_MIN' ) or sports_bench_stat_exists( $player, 'HITS' ) or sports_bench_stat_exists( $player, 'SHIFTS' ) or sports_bench_stat_exists( $player, 'ICE_TIME' ) or sports_bench_stat_exists( $player, 'FACE' ) or sports_bench_stat_exists( $player, 'FACE_WINS' ) ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $player as $the_player ) { $season_team = new Sports_Bench_Team( (int) $the_player->game_team_id ); if ( strlen( $the_player->ICE_TIME ) > 4 ) { $seconds = substr( $the_player->ICE_TIME, -2, 2 ); $time = substr_replace( $the_player->ICE_TIME, '', -2, 2 ); $minutes = substr( $time, -2, 2 ); $time = substr_replace( $time, '', -2, 2 ); $times = array( $time, $minutes, $seconds ); $time = implode( ':', $times ); } else { $seconds = substr( $the_player->ICE_TIME, -2, 2 ); $minutes = substr_replace( $the_player->ICE_TIME, '', -2, 2 ); $times = array( $minutes, $seconds ); $time = implode( ':', $times ); } $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Career Stats', 'sports-bench' ) . '' . __( 'G', 'sports-bench' ) . '' . __( 'A', 'sports-bench' ) . '' . __( 'PTS', 'sports-bench' ) . '' . __( '+/-', 'sports-bench' ) . '' . __( 'S', 'sports-bench' ) . '' . __( 'P', 'sports-bench' ) . '' . __( 'PM', 'sports-bench' ) . '' . __( 'H', 'sports-bench' ) . '' . __( 'SFT', 'sports-bench' ) . '' . __( 'TOI', 'sports-bench' ) . '' . __( 'FO-FW', 'sports-bench' ) . '
' . $the_player->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $the_player->GOALS . '' . $the_player->ASSISTS . '' . ( $the_player->GOALS + $the_player->ASSISTS ) . '' . $the_player->SOG . '' . $the_player->PM . '' . $the_player->PEN . '' . $the_player->PEN_MIN . '' . $the_player->HITS . '' . $the_player->SHIFTS . '' . $time . '' . $the_player->FACE . '-' . $the_player->FACE_WINS . '
'; } if ( sports_bench_stat_exists( $player, 'SHOTS_FACED' ) or sports_bench_stat_exists( $player, 'SAVES' ) or sports_bench_stat_exists( $player, 'GOALS_ALLOWED' ) ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $player as $the_player ) { $season_team = new Sports_Bench_Team( (int) $the_player->game_team_id ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Career Goalie Stats', 'sports-bench' ) . '' . __( 'SF', 'sports-bench' ) . '' . __( 'SAVES', 'sports-bench' ) . '' . __( 'GA', 'sports-bench' ) . '' . __( 'GAA', 'sports-bench' ) . '
' . $the_player->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $the_player->SHOTS_FACED . '' . $the_player->SAVES . '' . $the_player->GOALS_ALLOWED . '' . sports_bench_get_goals_against_average( (int)$the_player->GOALS_ALLOWED, (int)$the_player->GP ) . '
'; } $html .= '

' . sports_bench_show_stats_abbreviation_guide() . '

'; } elseif ( 'rugby' == $sport ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; global $wpdb; $player_table = $wpdb->prefix . 'sb_players'; $game_stats_table = $wpdb->prefix . 'sb_game_stats'; $game_table = $wpdb->prefix . 'sb_games'; $player_id = $player->player_id; $querystr = "SELECT p.player_id, p.player_first_name, p.player_last_name, p.team_id, game.game_id, game.game_season, g.game_id, g.game_team_id, g.game_player_id, SUM( g.game_player_tries ) as TRIES, COUNT( g.game_player_meters_run ) as GP, SUM( g.game_player_meters_run ) as METERS_RUN, SUM( g.game_player_assists ) as ASSISTS, SUM( g.game_player_conversions ) as CONVERSIONS, SUM( g.game_player_penalty_goals ) as PK_GOALS, SUM( g.game_player_drop_kicks ) as DROP_KICKS, SUM( g.game_player_points ) as POINTS, SUM( g.game_player_penalties_conceeded ) as PENALTIES_CONCEEDED, SUM( g.game_player_red_cards ) as REDS, SUM( g.game_player_yellow_cards ) as YELLOWS FROM $player_table as p LEFT JOIN $game_stats_table as g ON p.player_id = g.game_player_id LEFT JOIN $game_table as game ON game.game_id = g.game_id WHERE g.game_player_id = $player_id AND game.game_status = 'final' GROUP BY g.game_player_id, game.game_season, g.game_team_id;"; $seasons = $wpdb->get_results( $querystr ); foreach( $seasons as $season ) { $season_team = new Sports_Bench_Team( (int)$season->game_team_id ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'GP', 'sports-bench' ) . '' . __( 'T', 'sports-bench' ) . '' . __( 'A', 'sports-bench' ) . '' . __( 'C', 'sports-bench' ) . '' . __( 'PG', 'sports-bench' ) . '' . __( 'DK', 'sports-bench' ) . '' . __( 'PTS', 'sports-bench' ) . '' . __( 'PC', 'sports-bench' ) . '' . __( 'MR', 'sports-bench' ) . '' . __( 'R', 'sports-bench' ) . '' . __( 'Y', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $season->GP . '' . $season->TRIES . '' . $season->ASSISTS . '' . $season->CONVERSIONS . '' . $season->PK_GOALS . '' . $season->DROP_KICKS . '' . $season->POINTS . '' . $season->PENALTIES_CONCEEDED . '' . $season->METERS_RUN . '' . $season->REDS . '' . $season->YELLOWS . '
'; $html .= '

' . sports_bench_show_stats_abbreviation_guide() . '

'; } elseif ( 'soccer' == $sport ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; global $wpdb; $player_table = $wpdb->prefix . 'sb_players'; $game_stats_table = $wpdb->prefix . 'sb_game_stats'; $game_table = $wpdb->prefix . 'sb_games'; $player_id = $player->player_id; $querystr = "SELECT p.player_id, p.player_first_name, p.player_last_name, p.team_id, game.game_id, game.game_season, g.game_id, g.game_team_id, g.game_player_id, SUM( g.game_player_minutes ) as MINUTES, COUNT( g.game_player_minutes ) as GP, SUM( g.game_player_goals ) as GOALS, SUM( g.game_player_assists ) as ASSISTS, SUM( g.game_player_shots ) as SHOTS, SUM( g.game_player_sog ) as SOG, SUM( g.game_player_fouls ) as FOULS, SUM( g.game_player_fouls_suffered ) as FOULS_SUFFERED, SUM( g.game_player_shots_faced ) as SHOTS_FACED, SUM( g.game_player_shots_saved ) as SHOTS_SAVED, SUM( g.game_player_goals_allowed ) as GOALS_ALLOWED FROM $player_table as p LEFT JOIN $game_stats_table as g ON p.player_id = g.game_player_id LEFT JOIN $game_table as game ON game.game_id = g.game_id WHERE g.game_player_id = $player_id AND game.game_status = 'final' GROUP BY g.game_player_id, game.game_season;"; $players = $wpdb->get_results( $querystr ); foreach( $players as $the_player ) { $season_team = new Sports_Bench_Team( (int)$the_player->game_team_id ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Career Stats', 'sports-bench' ) . '' . __( 'MIN', 'sports-bench' ) . '' . __( 'G', 'sports-bench' ) . '' . __( 'A', 'sports-bench' ) . '' . __( 'SH', 'sports-bench' ) . '' . __( 'SOG', 'sports-bench' ) . '' . __( 'F', 'sports-bench' ) . '' . __( 'FS', 'sports-bench' ) . '' . __( 'SF', 'sports-bench' ) . '' . __( 'SV', 'sports-bench' ) . '' . __( 'GA', 'sports-bench' ) . '' . __( 'GAA', 'sports-bench' ) . '
' . $the_player->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $the_player->MINUTES. '' . $the_player->GOALS. '' . $the_player->ASSISTS . '' . $the_player->SHOTS . '' . $the_player->SOG . '' . $the_player->FOULS . '' . $the_player->FOULS_SUFFERED . '' . $the_player->SHOTS_FACED . '' . $the_player->SHOTS_SAVED . '' . $the_player->GOALS_ALLOWED . '' . sports_bench_get_goals_against_average( (int)$the_player->GOALS_ALLOWED, (int)$the_player->GP ) . '
'; $html .= '

' . sports_bench_show_stats_abbreviation_guide() . '

'; } elseif ( 'volleyball' == $sport ) { $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_player_stats_head_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; global $wpdb; $player_table = $wpdb->prefix . 'sb_players'; $game_stats_table = $wpdb->prefix . 'sb_game_stats'; $game_table = $wpdb->prefix . 'sb_games'; $player_id = $player->player_id; $querystr = "SELECT p.player_id, p.player_first_name, p.player_last_name, p.team_id, game.game_id, game.game_season, g.game_id, g.game_team_id, g.game_player_id, SUM( g.game_player_sets_played ) as SETS_PLAYED, COUNT( g.game_player_sets_played ) as GP, SUM( g.game_player_points ) as POINTS, SUM( g.game_player_kills ) as KILLS, SUM( g.game_player_hitting_errors ) as HITTING_ERRORS, SUM( g.game_player_attacks ) as ATTACKS, SUM( g.game_player_set_attempts ) as SET_ATT, SUM( g.game_player_set_errors ) as SET_ERR, SUM( g.game_player_serves ) as SERVES, SUM( g.game_player_serve_errors ) as SE, SUM( g.game_player_aces ) as SA, SUM( g.game_player_blocks ) as BLOCKS, SUM( g.game_player_block_attempts ) as BA, SUM( g.game_player_block_errors) as BE, SUM( g.game_player_digs ) as DIGS, SUM( g.game_player_receiving_errors) as RE FROM $player_table as p LEFT JOIN $game_stats_table as g ON p.player_id = g.game_player_id LEFT JOIN $game_table as game ON game.game_id = g.game_id WHERE g.game_player_id = $player_id AND game.game_status = 'final' GROUP BY g.game_player_id, game.game_season, g.game_team_id;"; $seasons = $wpdb->get_results( $querystr ); foreach( $seasons as $season ) { $season_team = new Sports_Bench_Team( (int)$season->game_team_id ); $table_row_styles = apply_filters( 'sports_bench_player_stats_row', '', $player ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'GP', 'sports-bench' ) . '' . __( 'SP', 'sports-bench' ) . '' . __( 'PTS', 'sports-bench' ) . '' . __( 'HIT %', 'sports-bench' ) . '' . __( 'K', 'sports-bench' ) . '' . __( 'ATT', 'sports-bench' ) . '' . __( 'HE', 'sports-bench' ) . '' . __( 'SET E', 'sports-bench' ) . '' . __( 'SET A', 'sports-bench' ) . '' . __( 'S', 'sports-bench' ) . '' . __( 'SE', 'sports-bench' ) . '' . __( 'ACE', 'sports-bench' ) . '' . __( 'B', 'sports-bench' ) . '' . __( 'BA', 'sports-bench' ) . '' . __( 'BE', 'sports-bench' ) . '' . __( 'DIG', 'sports-bench' ) . '' . __( 'RE', 'sports-bench' ) . '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . '' . $season->GP . '' . $season->SETS_PLAYED . '' . $season->POINTS . '' . sports_bench_get_hitting_percentage( $season->ATTACKS, $season->KILLS, $season->HITTING_ERRORS ) . '' . $season->KILLS . '' . $season->ATTACKS . '' . $season->HITTING_ERRORS . '' . $season->SET_ERR . '' . $season->SET_ATT . '' . $season->SERVES . '' . $season->SE . '' . $season->SA . '' . $season->BLOCKS . '' . $season->BA . '' . $season->BE . '' . $season->DIGS . '' . $season->RE . '
'; $html .= '

' . sports_bench_show_stats_abbreviation_guide() . '

'; } else { } return $html; } add_filter( 'sports_bench_player_stats_table', 'sports_bench_do_player_stats_table', 10, 4 );