Add all team statistics in player profile row
This commit is contained in:
@@ -115,43 +115,10 @@ function sportspress_player_team_meta( $post ) {
|
|||||||
sportspress_post_adder( 'sp_team' );
|
sportspress_post_adder( 'sp_team' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function sportspress_player_stats_meta( $post ) {
|
|
||||||
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
|
||||||
|
|
||||||
$league_num = sizeof( $leagues );
|
|
||||||
|
|
||||||
// Loop through statistics for each league
|
|
||||||
foreach ( $leagues as $league ):
|
|
||||||
|
|
||||||
if ( $league_num > 1 ):
|
|
||||||
?>
|
|
||||||
<p><strong><?php echo $league->name; ?></strong></p>
|
|
||||||
<?php
|
|
||||||
endif;
|
|
||||||
|
|
||||||
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = sportspress_get_player_statistics_data( $post->ID, $league->term_id, true );
|
|
||||||
|
|
||||||
sportspress_edit_player_statistics_table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, ! current_user_can( 'edit_sp_teams' ) );
|
|
||||||
|
|
||||||
endforeach;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sportspress_player_metrics_meta( $post ) {
|
function sportspress_player_metrics_meta( $post ) {
|
||||||
$metrics = get_post_meta( $post->ID, 'sp_metrics', true );
|
$metrics = get_post_meta( $post->ID, 'sp_metrics', true );
|
||||||
$positions = get_the_terms( $post->ID, 'sp_position' );
|
$positions = get_the_terms( $post->ID, 'sp_position' );
|
||||||
|
|
||||||
?>
|
|
||||||
<div class="sp-data-table-container">
|
|
||||||
<table class="widefat sp-data-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><?php _e( 'Metric', 'sportspress' ); ?></th>
|
|
||||||
<th><?php _e( 'Value', 'sportspress' ); ?></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_type' => 'sp_metric',
|
'post_type' => 'sp_metric',
|
||||||
'numberposts' => -1,
|
'numberposts' => -1,
|
||||||
@@ -176,6 +143,18 @@ function sportspress_player_metrics_meta( $post ) {
|
|||||||
|
|
||||||
$vars = get_posts( $args );
|
$vars = get_posts( $args );
|
||||||
|
|
||||||
|
if ( $vars ):
|
||||||
|
?>
|
||||||
|
<div class="sp-data-table-container">
|
||||||
|
<table class="widefat sp-data-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php _e( 'Metric', 'sportspress' ); ?></th>
|
||||||
|
<th><?php _e( 'Value', 'sportspress' ); ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ( $vars as $var ):
|
foreach ( $vars as $var ):
|
||||||
?>
|
?>
|
||||||
@@ -196,9 +175,34 @@ function sportspress_player_metrics_meta( $post ) {
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
else:
|
||||||
|
sportspress_post_adder( 'sp_metric' );
|
||||||
|
endif;
|
||||||
|
|
||||||
sportspress_nonce();
|
sportspress_nonce();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sportspress_player_stats_meta( $post ) {
|
||||||
|
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
||||||
|
|
||||||
|
$league_num = sizeof( $leagues );
|
||||||
|
|
||||||
|
// Loop through statistics for each league
|
||||||
|
foreach ( $leagues as $league ):
|
||||||
|
|
||||||
|
if ( $league_num > 1 ):
|
||||||
|
?>
|
||||||
|
<p><strong><?php echo $league->name; ?></strong></p>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
|
||||||
|
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = sportspress_get_player_statistics_data( $post->ID, $league->term_id, true );
|
||||||
|
|
||||||
|
sportspress_edit_player_statistics_table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, ! current_user_can( 'edit_sp_teams' ) );
|
||||||
|
|
||||||
|
endforeach;
|
||||||
|
}
|
||||||
|
|
||||||
function sportspress_player_profile_meta( $post ) {
|
function sportspress_player_profile_meta( $post ) {
|
||||||
wp_editor( $post->post_content, 'content' );
|
wp_editor( $post->post_content, 'content' );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2148,11 +2148,11 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) {
|
|||||||
'numberposts' => -1,
|
'numberposts' => -1,
|
||||||
'posts_per_page' => -1,
|
'posts_per_page' => -1,
|
||||||
'meta_query' => array(
|
'meta_query' => array(
|
||||||
'relation' => 'AND',
|
// 'relation' => 'AND',
|
||||||
array(
|
// array(
|
||||||
'key' => 'sp_team',
|
// 'key' => 'sp_team',
|
||||||
'value' => $team_id
|
// 'value' => $team_id
|
||||||
),
|
// ),
|
||||||
array(
|
array(
|
||||||
'key' => 'sp_player',
|
'key' => 'sp_player',
|
||||||
'value' => $post_id
|
'value' => $post_id
|
||||||
@@ -2178,17 +2178,21 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) {
|
|||||||
$totals['eventsattended']++;
|
$totals['eventsattended']++;
|
||||||
$totals['eventsplayed']++;
|
$totals['eventsplayed']++;
|
||||||
$team_statistics = (array)get_post_meta( $event->ID, 'sp_players', true );
|
$team_statistics = (array)get_post_meta( $event->ID, 'sp_players', true );
|
||||||
if ( array_key_exists( $team_id, $team_statistics ) ):
|
|
||||||
$players = sportspress_array_value( $team_statistics, $team_id, array() );
|
// Add all team statistics
|
||||||
|
// if ( array_key_exists( $team_id, $team_statistics ) ):
|
||||||
|
foreach ( $team_statistics as $players ):
|
||||||
|
// $players = sportspress_array_value( $team_statistics, $team_id, array() );
|
||||||
if ( array_key_exists( $post_id, $players ) ):
|
if ( array_key_exists( $post_id, $players ) ):
|
||||||
$player_statistics = sportspress_array_value( $players, $post_id, array() );
|
$player_statistics = sportspress_array_value( $players, $post_id, array() );
|
||||||
foreach ( $player_statistics as $key => $value ):
|
foreach ( $player_statistics as $key => $value ):
|
||||||
if ( array_key_exists( $key, $totals ) ):
|
array_key_exists( $key, $totals ) ):
|
||||||
$totals[ $key ] += $value;
|
$totals[ $key ] += $value;
|
||||||
endif;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
endif;
|
// endif;
|
||||||
|
endforeach;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
// Generate array of placeholder values for each league
|
// Generate array of placeholder values for each league
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
=== SportsPress - Automated League Statistics ===
|
=== SportsPress - automated league statistics ===
|
||||||
Contributors: themeboy
|
Contributors: themeboy
|
||||||
Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, leagues, reporting, themeboy, wordpress sports, configurable
|
Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, leagues, reporting, themeboy, wordpress sports, configurable
|
||||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress
|
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress
|
||||||
Requires at least: 3.8
|
Requires at least: 3.8
|
||||||
Tested up to: 3.8.1
|
Tested up to: 3.8.1
|
||||||
Stable tag: 0.2.8
|
Stable tag: 0.2.9
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
@@ -91,6 +91,10 @@ SportsPress is currently in beta and is undergoing testing. We are still activel
|
|||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 0.2.9 =
|
||||||
|
* Feature - Ability to select players from all teams in player list.
|
||||||
|
* Fix - Decimal sorting in league tables and player lists.
|
||||||
|
|
||||||
= 0.2.8 =
|
= 0.2.8 =
|
||||||
* Feature - Add player list widget.
|
* Feature - Add player list widget.
|
||||||
* Localization - Add German translations.
|
* Localization - Add German translations.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
Plugin Name: SportsPress
|
Plugin Name: SportsPress
|
||||||
Plugin URI: http://themeboy.com/sportspress
|
Plugin URI: http://themeboy.com/sportspress
|
||||||
Description: Manage your club and its players, staff, events, league tables, and player lists.
|
Description: Manage your club and its players, staff, events, league tables, and player lists.
|
||||||
Version: 0.2.8
|
Version: 0.2.9
|
||||||
Author: ThemeBoy
|
Author: ThemeBoy
|
||||||
Author URI: http://themeboy.com/
|
Author URI: http://themeboy.com/
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
@@ -18,7 +18,7 @@ if ( !function_exists( 'add_action' ) ) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
define( 'SPORTSPRESS_VERSION', '0.2.8' );
|
define( 'SPORTSPRESS_VERSION', '0.2.9' );
|
||||||
define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||||
define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
||||||
define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ );
|
define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ );
|
||||||
|
|||||||
Reference in New Issue
Block a user