Fix permissions, add post filters

This commit is contained in:
Brian Miyaji
2014-02-01 22:28:49 +11:00
parent b3270a06b1
commit bd8561cdba
15 changed files with 290 additions and 203 deletions

View File

@@ -11,24 +11,26 @@ function sportspress_admin_init() {
); );
$caps = array( $caps = array(
'publish',
'read', 'read',
'delete', 'read_private',
'delete_others',
'delete_private',
'delete_published',
'edit', 'edit',
'edit_others', 'edit_others',
'edit_private', 'edit_private',
'edit_published', 'edit_published',
'read_private', 'publish',
'delete',
'delete_others',
'delete_private',
'delete_published',
); );
// Site Admin // Site Admin
$administrator = get_role( 'administrator' ); $administrator = get_role( 'administrator' );
foreach( $post_types as $post_type ): foreach( $post_types as $post_type ):
$administrator->add_cap( 'read_' . $post_type );
$administrator->add_cap( 'edit_' . $post_type ); $administrator->add_cap( 'edit_' . $post_type );
$administrator->add_cap( 'delete_' . $post_type );
foreach ( $caps as $cap ): foreach ( $caps as $cap ):
$administrator->add_cap( $cap . '_' . $post_type . 's' ); $administrator->add_cap( $cap . '_' . $post_type . 's' );
endforeach; endforeach;

View File

@@ -34,6 +34,7 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
$team = get_post( $team_id ); $team = get_post( $team_id );
$outcome_slug = sportspress_array_value( sportspress_array_value( $results, $team_id, null ), 'outcome', null ); $outcome_slug = sportspress_array_value( sportspress_array_value( $results, $team_id, null ), 'outcome', null );
echo $team->post_title;
if ( $outcome_slug && $outcome_slug != '-1' ): if ( $outcome_slug && $outcome_slug != '-1' ):
$args=array( $args=array(
'name' => $outcome_slug, 'name' => $outcome_slug,
@@ -43,10 +44,12 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
); );
$outcomes = get_posts( $args ); $outcomes = get_posts( $args );
echo $team->post_title . ( $outcomes ? ' &mdash; ' . $outcomes[0]->post_title : '' ) . '<br>'; if ( sizeof( $outcomes ) ):
else: $outcome = reset( $outcomes );
echo $team->post_title . '<br>'; echo ' &mdash; ' . $outcome->post_title;
endif; endif;
endif;
echo '<br>';
endforeach; endforeach;
elseif ( $post_type == 'sp_player' ): elseif ( $post_type == 'sp_player' ):
$results = get_post_meta( $post_id, 'sp_results', true ); $results = get_post_meta( $post_id, 'sp_results', true );

View File

@@ -0,0 +1,13 @@
<?php
function sportspress_parse_query( $query ) {
global $pagenow, $typenow;
if ( is_admin() && $pagenow == 'edit.php' ):
if( in_array( $typenow, array( 'sp_event', 'sp_table', 'sp_player', 'sp_list', 'sp_staff' ) ) && isset( $_GET['team'] ) ):
$query->query_vars['meta_key'] = 'sp_team';
$query->query_vars['meta_value'] = $_GET['team'];
endif;
endif;
}
add_filter('parse_query', 'sportspress_parse_query');

View File

@@ -1,15 +1,18 @@
<?php <?php
function sportspress_pre_get_posts( $wp_query ) { function sportspress_pre_get_posts( $query ) {
if ( is_admin() ): if( !is_admin() )
$post_type = $wp_query->query['post_type']; return $query;
$post_type = $query->query['post_type'];
if ( in_array( $post_type, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic' ) ) ): if ( in_array( $post_type, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic' ) ) ):
$wp_query->set( 'orderby', 'menu_order' ); $query->set( 'orderby', 'menu_order' );
$wp_query->set( 'order', 'ASC' ); $query->set( 'order', 'ASC' );
elseif ( $post_type == 'sp_event' ): elseif ( $post_type == 'sp_event' ):
$wp_query->set( 'orderby', 'post_date' ); $query->set( 'orderby', 'post_date' );
$wp_query->set( 'order', 'ASC' ); $query->set( 'order', 'ASC' );
endif;
endif; endif;
return $query;
} }
add_filter('pre_get_posts', 'sportspress_pre_get_posts'); add_filter('pre_get_posts', 'sportspress_pre_get_posts');

View File

@@ -32,5 +32,16 @@ function sportspress_restrict_manage_posts() {
); );
sportspress_dropdown_taxonomies( $args ); sportspress_dropdown_taxonomies( $args );
endif; endif;
if ( in_array( $typenow, array( 'sp_event', 'sp_table', 'sp_player', 'sp_list', 'sp_staff' ) ) ):
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
$args = array(
'post_type' => 'sp_team',
'name' => 'team',
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Teams', 'sportspress' ) ),
'selected' => $selected,
'values' => 'ID',
);
sportspress_dropdown_pages( $args );
endif;
} }
add_action( 'restrict_manage_posts', 'sportspress_restrict_manage_posts' ); add_action( 'restrict_manage_posts', 'sportspress_restrict_manage_posts' );

View File

@@ -6,7 +6,7 @@ function sportspress_enqueue_scripts() {
// Scripts // Scripts
wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3.exp', true ); wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3.exp', true );
wp_enqueue_script( 'jquery-datatables', SPORTSPRESS_PLUGIN_URL .'/assets/js/jquery.dataTables.min.js', array( 'jquery' ), '1.9.4', true ); wp_enqueue_script( 'jquery-datatables', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.dataTables.min.js', array( 'jquery' ), '1.9.4', true );
wp_enqueue_script( 'sportspress', SPORTSPRESS_PLUGIN_URL .'/assets/js/sportspress.js', array( 'jquery' ), time(), true ); wp_enqueue_script( 'sportspress', SPORTSPRESS_PLUGIN_URL .'assets/js/sportspress.js', array( 'jquery' ), time(), true );
} }
add_action( 'wp_enqueue_scripts', 'sportspress_enqueue_scripts' ); add_action( 'wp_enqueue_scripts', 'sportspress_enqueue_scripts' );

View File

@@ -47,7 +47,7 @@ function sportspress_player_meta_init( $post ) {
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_player_team_meta', 'sp_player', 'side', 'high' ); add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_player_team_meta', 'sp_player', 'side', 'high' );
add_meta_box( 'sp_metricsdiv', __( 'Metrics', 'sportspress' ), 'sportspress_player_metrics_meta', 'sp_player', 'normal', 'high' ); add_meta_box( 'sp_metricsdiv', __( 'Metrics', 'sportspress' ), 'sportspress_player_metrics_meta', 'sp_player', 'normal', 'high' );
if ( $leagues && ! empty( $leagues ) && $seasons && is_array( $seasons ) && is_object( $seasons[0] ) ): if ( $leagues && ! empty( $leagues ) && $seasons && ! empty( $seasons ) ):
add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sportspress_player_stats_meta', 'sp_player', 'normal', 'high' ); add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sportspress_player_stats_meta', 'sp_player', 'normal', 'high' );
endif; endif;
@@ -131,7 +131,7 @@ function sportspress_player_stats_meta( $post ) {
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = sportspress_get_player_statistics_data( $post->ID, $league->term_id, true ); list( $columns, $data, $placeholders, $merged, $seasons_teams ) = sportspress_get_player_statistics_data( $post->ID, $league->term_id, true );
sportspress_edit_player_statistics_table( $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, ! current_user_can( 'edit_sp_teams' ) ); sportspress_edit_player_statistics_table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, ! current_user_can( 'edit_sp_teams' ) );
endforeach; endforeach;
} }

View File

@@ -4,6 +4,32 @@ global $sportspress_sports;
$sportspress_sports['rugby'] = array( $sportspress_sports['rugby'] = array(
'name' => __( 'Rugby', 'sportspress' ), 'name' => __( 'Rugby', 'sportspress' ),
'posts' => array( 'posts' => array(
// Results
'sp_result' => array(
array(
'post_title' => __( 'Points', 'sportspress' ),
'post_name' => 'points',
),
array(
'post_title' => __( 'Bonus', 'sportspress' ),
'post_name' => 'bonus',
),
),
// Outcomes
'sp_outcome' => array(
array(
'post_title' => 'W',
'post_name' => 'w',
),
array(
'post_title' => 'D',
'post_name' => 'd',
),
array(
'post_title' => 'L',
'post_name' => 'l',
),
),
// Table Columns // Table Columns
'sp_column' => array( 'sp_column' => array(
array( array(
@@ -11,6 +37,7 @@ $sportspress_sports['rugby'] = array(
'post_name' => 'p', 'post_name' => 'p',
'meta' => array( 'meta' => array(
'sp_equation' => '$eventsplayed', 'sp_equation' => '$eventsplayed',
'sp_precision' => 1,
), ),
), ),
array( array(
@@ -18,6 +45,7 @@ $sportspress_sports['rugby'] = array(
'post_name' => 'w', 'post_name' => 'w',
'meta' => array( 'meta' => array(
'sp_equation' => '$w', 'sp_equation' => '$w',
'sp_precision' => 1,
), ),
), ),
array( array(
@@ -25,6 +53,7 @@ $sportspress_sports['rugby'] = array(
'post_name' => 'd', 'post_name' => 'd',
'meta' => array( 'meta' => array(
'sp_equation' => '$d', 'sp_equation' => '$d',
'sp_precision' => 1,
), ),
), ),
array( array(
@@ -32,54 +61,100 @@ $sportspress_sports['rugby'] = array(
'post_name' => 'l', 'post_name' => 'l',
'meta' => array( 'meta' => array(
'sp_equation' => '$l', 'sp_equation' => '$l',
'sp_precision' => 1,
), ),
), ),
array( array(
'post_title' => 'B', 'post_title' => 'B',
'post_name' => 'b', 'post_name' => 'b',
'meta' => array( 'meta' => array(
'sp_equation' => '$b', 'sp_equation' => '$bonus',
'sp_precision' => 1,
), ),
), ),
array( array(
'post_title' => 'F', 'post_title' => 'F',
'post_name' => 'f', 'post_name' => 'f',
'meta' => array( 'meta' => array(
'sp_equation' => '$ptsfor', 'sp_equation' => '$pointsfor',
'sp_precision' => 1,
), ),
), ),
array( array(
'post_title' => 'A', 'post_title' => 'A',
'post_name' => 'a', 'post_name' => 'a',
'meta' => array( 'meta' => array(
'sp_equation' => '$ptsagainst', 'sp_equation' => '$pointsagainst',
'sp_precision' => 1,
), ),
), ),
array( array(
'post_title' => '+/-', 'post_title' => '+/-',
'post_name' => 'pd', 'post_name' => 'pd',
'meta' => array( 'meta' => array(
'sp_equation' => '$ptsfor - $ptsagainst', 'sp_equation' => '$pointsfor - $pointsagainst',
'sp_precision' => 1,
), ),
), ),
array( array(
'post_title' => 'Pts', 'post_title' => 'Pts',
'post_name' => 'pts', 'post_name' => 'pts',
'meta' => array( 'meta' => array(
'sp_equation' => '( $w + $b ) * 2 + $d', 'sp_equation' => '( $w + $bonus ) * 2 + $d',
'sp_precision' => 1,
'sp_priority' => '1', 'sp_priority' => '1',
'sp_order' => 'DESC', 'sp_order' => 'DESC',
), ),
), ),
), ),
// Statistics // Player Metrics
'sp_metric' => array(
array(
'post_title' => __( 'Height', 'sportspress' ),
'post_name' => 'height',
),
array(
'post_title' => __( 'Weight', 'sportspress' ),
'post_name' => 'weight',
),
),
// Player Statistics
'sp_statistic' => array( 'sp_statistic' => array(
array(
'post_title' => __( 'Points', 'sportspress' ),
'post_name' => 'points',
'meta' => array(
'sp_calculate' => 'sum',
),
),
array(
'post_title' => __( 'Tries', 'sportspress' ),
'post_name' => 'tries',
'meta' => array(
'sp_calculate' => 'sum',
),
),
array(
'post_title' => __( 'Conversions', 'sportspress' ),
'post_name' => 'conversions',
'meta' => array(
'sp_calculate' => 'sum',
),
),
array(
'post_title' => __( 'Penalty Goals', 'sportspress' ),
'post_name' => 'penaltygoals',
'meta' => array(
'sp_calculate' => 'sum',
),
),
array(
'post_title' => __( 'Drop Goals', 'sportspress' ),
'post_name' => 'dropgoals',
'meta' => array(
'sp_calculate' => 'sum',
), ),
// Results
'sp_result' => array(
), ),
// Outcomes
'sp_outcome' => array(
), ),
), ),
); );

View File

@@ -4,166 +4,11 @@ global $sportspress_sports;
$sportspress_sports['soccer'] = array( $sportspress_sports['soccer'] = array(
'name' => __( 'Association Football (Soccer)', 'sportspress' ), 'name' => __( 'Association Football (Soccer)', 'sportspress' ),
'posts' => array( 'posts' => array(
// Table Columns
'sp_column' => array(
array(
'post_title' => 'P',
'post_name' => 'p',
'meta' => array(
'sp_equation' => '$eventsplayed',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'W',
'post_name' => 'w',
'meta' => array(
'sp_equation' => '$w',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'D',
'post_name' => 'd',
'meta' => array(
'sp_equation' => '$d',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'L',
'post_name' => 'l',
'meta' => array(
'sp_equation' => '$l',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'F',
'post_name' => 'f',
'meta' => array(
'sp_equation' => '$goalsfor',
'sp_priority' => '3',
'sp_order' => 'DESC',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'A',
'post_name' => 'a',
'meta' => array(
'sp_equation' => '$goalsagainst',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'GD',
'post_name' => 'gd',
'meta' => array(
'sp_equation' => '$goalsfor - $goalsagainst',
'sp_priority' => '2',
'sp_order' => 'DESC',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'Pts',
'post_name' => 'pts',
'meta' => array(
'sp_equation' => '$w * 3 + $d',
'sp_priority' => '1',
'sp_order' => 'DESC',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
),
// Player Statistics
'sp_statistic' => array(
array(
'post_title' => 'Goals',
'post_name' => 'goals',
'meta' => array(
'sp_equation' => '',
'sp_priority' => '1',
'sp_order' => 'DESC',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'Assists',
'post_name' => 'assists',
'meta' => array(
'sp_equation' => '',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'Yellow Cards',
'post_name' => 'yellowcards',
'meta' => array(
'sp_equation' => '',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'Red Cards',
'post_name' => 'redcards',
'meta' => array(
'sp_equation' => '',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
),
// Player Metrics
'sp_metric' => array(
array(
'post_title' => 'Appearances',
'post_name' => 'appearances',
'meta' => array(
'sp_equation' => '$eventsplayed',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'Height',
'post_name' => 'height',
'meta' => array(
'sp_equation' => '',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
array(
'post_title' => 'Weight',
'post_name' => 'weight',
'meta' => array(
'sp_equation' => '',
'sp_format' => 'integer',
'sp_precision' => 1,
),
),
),
// Results // Results
'sp_result' => array( 'sp_result' => array(
array( array(
'post_title' => 'Goals', 'post_title' => __( 'Goals', 'sportspress' ),
'post_name' => 'goals', 'post_name' => 'goals',
'meta' => array(
'sp_format' => 'integer',
),
), ),
), ),
// Outcomes // Outcomes
@@ -181,5 +26,120 @@ $sportspress_sports['soccer'] = array(
'post_name' => 'l', 'post_name' => 'l',
), ),
), ),
// Table Columns
'sp_column' => array(
array(
'post_title' => 'P',
'post_name' => 'p',
'meta' => array(
'sp_equation' => '$eventsplayed',
'sp_precision' => 1,
),
),
array(
'post_title' => 'W',
'post_name' => 'w',
'meta' => array(
'sp_equation' => '$w',
'sp_precision' => 1,
),
),
array(
'post_title' => 'D',
'post_name' => 'd',
'meta' => array(
'sp_equation' => '$d',
'sp_precision' => 1,
),
),
array(
'post_title' => 'L',
'post_name' => 'l',
'meta' => array(
'sp_equation' => '$l',
'sp_precision' => 1,
),
),
array(
'post_title' => 'F',
'post_name' => 'f',
'meta' => array(
'sp_equation' => '$goalsfor',
'sp_precision' => 1,
'sp_priority' => '3',
'sp_order' => 'DESC',
),
),
array(
'post_title' => 'A',
'post_name' => 'a',
'meta' => array(
'sp_equation' => '$goalsagainst',
'sp_precision' => 1,
),
),
array(
'post_title' => 'GD',
'post_name' => 'gd',
'meta' => array(
'sp_equation' => '$goalsfor - $goalsagainst',
'sp_precision' => 1,
'sp_priority' => '2',
'sp_order' => 'DESC',
),
),
array(
'post_title' => 'Pts',
'post_name' => 'pts',
'meta' => array(
'sp_equation' => '$w * 3 + $d',
'sp_precision' => 1,
'sp_priority' => '1',
'sp_order' => 'DESC',
),
),
),
// Player Metrics
'sp_metric' => array(
array(
'post_title' => __( 'Height', 'sportspress' ),
'post_name' => 'height',
),
array(
'post_title' => __( 'Weight', 'sportspress' ),
'post_name' => 'weight',
),
),
// Player Statistics
'sp_statistic' => array(
array(
'post_title' => __( 'Goals', 'sportspress' ),
'post_name' => 'goals',
'meta' => array(
'sp_calculate' => 'sum',
),
),
array(
'post_title' => __( 'Assists', 'sportspress' ),
'post_name' => 'assists',
'meta' => array(
'sp_calculate' => 'sum',
),
),
array(
'post_title' => __( 'Yellow Cards', 'sportspress' ),
'post_name' => 'yellowcards',
'meta' => array(
'sp_calculate' => 'sum',
),
),
array(
'post_title' => __( 'Red Cards', 'sportspress' ),
'post_name' => 'redcards',
'meta' => array(
'sp_calculate' => 'sum',
),
),
),
), ),
); );

View File

@@ -17,10 +17,14 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
$seasons = get_the_terms( $id, 'sp_season' ); $seasons = get_the_terms( $id, 'sp_season' );
$terms = array(); $terms = array();
if ( isset( $leagues[0] ) ) if ( sizeof( $leagues ) ):
$terms[] = $leagues[0]->name; $league = reset( $leagues );
if ( isset( $seasons[0] ) ) $terms[] = $league->name;
$terms[] = $seasons[0]->name; endif;
if ( sizeof( $seasons ) ):
$season = reset( $seasons );
$terms[] = $season->name;
endif;
$title = sizeof( $terms ) ? implode( ' &mdash; ', $terms ) : get_the_title( $id ); $title = sizeof( $terms ) ? implode( ' &mdash; ', $terms ) : get_the_title( $id );

View File

@@ -57,8 +57,9 @@ add_action( 'sp_venue_edit_form_fields', 'sportspress_venue_edit_form_fields', 1
// Get latitude and longitude from the last added venue // Get latitude and longitude from the last added venue
$terms = get_terms( 'sp_venue', $args ); $terms = get_terms( 'sp_venue', $args );
if ( $terms && array_key_exists( 0, $terms) && is_object( $terms[0] ) ): if ( $terms && array_key_exists( 0, $terms) && is_object( reset( $terms ) ) ):
$t_id = $terms[0]->term_id; $term = reset( $terms );
$t_id = $term->term_id;
$term_meta = get_option( "taxonomy_$t_id" ); $term_meta = get_option( "taxonomy_$t_id" );
$latitude = sportspress_array_value( $term_meta, 'sp_latitude', '40.7324319' ); $latitude = sportspress_array_value( $term_meta, 'sp_latitude', '40.7324319' );
$longitude = sportspress_array_value( $term_meta, 'sp_longitude', '-73.82480799999996' ); $longitude = sportspress_array_value( $term_meta, 'sp_longitude', '-73.82480799999996' );

View File

@@ -49,6 +49,7 @@
width: 50%; width: 50%;
overflow: hidden; overflow: hidden;
overflow-x: scroll; overflow-x: scroll;
box-shadow: 0 0 1em rgba(0,0,0,0.5);
} }
.sp-pinned-table table { .sp-pinned-table table {
border-right: none; border-right: none;

View File

@@ -122,6 +122,9 @@ if ( !function_exists( 'sportspress_get_post_views' ) ) {
if ( !function_exists( 'sportspress_set_post_views' ) ) { if ( !function_exists( 'sportspress_set_post_views' ) ) {
function sportspress_set_post_views( $post_id ) { function sportspress_set_post_views( $post_id ) {
if ( is_preview() )
return;
$count_key = 'sp_views'; $count_key = 'sp_views';
$count = get_post_meta( $post_id, $count_key, true ); $count = get_post_meta( $post_id, $count_key, true );
if ( $count == '' ): if ( $count == '' ):
@@ -766,7 +769,11 @@ if ( !function_exists( 'sportspress_edit_team_columns_table' ) ) {
} }
if ( !function_exists( 'sportspress_edit_player_statistics_table' ) ) { if ( !function_exists( 'sportspress_edit_player_statistics_table' ) ) {
function sportspress_edit_player_statistics_table( $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $seasons_teams = array(), $readonly = true ) { function sportspress_edit_player_statistics_table( $id = null, $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $seasons_teams = array(), $readonly = true ) {
if ( ! $id )
$id = get_the_ID();
$teams = array_filter( get_post_meta( $id, 'sp_team', false ) );
?> ?>
<div class="sp-data-table-container"> <div class="sp-data-table-container">
<table class="widefat sp-data-table"> <table class="widefat sp-data-table">
@@ -796,11 +803,12 @@ if ( !function_exists( 'sportspress_edit_player_statistics_table' ) ) {
$args = array( $args = array(
'post_type' => 'sp_team', 'post_type' => 'sp_team',
'name' => 'sp_leagues[' . $league_id . '][' . $div_id . ']', 'name' => 'sp_leagues[' . $league_id . '][' . $div_id . ']',
'show_option_none' => __( '-- Select --', 'sportspress' ), 'show_option_none' => __( '-- Not Set --', 'sportspress' ),
'sort_order' => 'ASC', 'sort_order' => 'ASC',
'sort_column' => 'menu_order', 'sort_column' => 'menu_order',
'selected' => $value, 'selected' => $value,
'values' => 'ID', 'values' => 'ID',
'include' => $teams,
'tax_query' => array( 'tax_query' => array(
'relation' => 'AND', 'relation' => 'AND',
array( array(
@@ -1373,7 +1381,7 @@ if ( !function_exists( 'sportspress_get_team_columns_data' ) ) {
$outcomes = get_posts( $args ); $outcomes = get_posts( $args );
if ( $outcomes ): if ( $outcomes ):
$outcome = $outcomes[0]; $outcome = reset( $outcomes );
$totals['streak'] = $outcome->post_title . $streak['count']; $totals['streak'] = $outcome->post_title . $streak['count'];
endif; endif;
@@ -1583,7 +1591,7 @@ if ( !function_exists( 'sportspress_get_league_table_data' ) ) {
$outcomes = get_posts( $args ); $outcomes = get_posts( $args );
if ( $outcomes ): if ( $outcomes ):
$outcome = $outcomes[0]; $outcome = reset( $outcomes );
$totals[ $team_id ]['streak'] = $outcome->post_title . $streak['count']; $totals[ $team_id ]['streak'] = $outcome->post_title . $streak['count'];
else: else:
$totals[ $team_id ]['streak'] = '&mdash;'; $totals[ $team_id ]['streak'] = '&mdash;';

View File

@@ -4,7 +4,7 @@ Tags: sports, sports journalism, teams, team management, fixtures, results, stan
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.5 Requires at least: 3.5
Tested up to: 3.8 Tested up to: 3.8
Stable tag: 0.2 Stable tag: 0.2.1
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
@@ -72,6 +72,11 @@ SportsPress is currently in beta and is undergoing testing. We are still activel
== Changelog == == Changelog ==
= 0.2.1 =
* Feature - Events Calendar widget added.
* Fix - Player settings table markup fixed.
* Tweak - Refine custom post type capabilities for user roles.
= 0.2 = = 0.2 =
* Feature - Add option to select whether statistics are calculated as a sum or average. * Feature - Add option to select whether statistics are calculated as a sum or average.
* Feature - Enable pageview tracking for posts and custom post types. * Feature - Enable pageview tracking for posts and custom post types.

View File

@@ -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 Version: 0.2.1
Author: ThemeBoy Author: ThemeBoy
Author URI: http://themeboy.com/ Author URI: http://themeboy.com/
License: GPLv3 License: GPLv3
@@ -91,6 +91,7 @@ require_once dirname( __FILE__ ) . '/admin/hooks/admin-head.php';
require_once dirname( __FILE__ ) . '/admin/hooks/manage-posts-columns.php'; require_once dirname( __FILE__ ) . '/admin/hooks/manage-posts-columns.php';
require_once dirname( __FILE__ ) . '/admin/hooks/post-thumbnail-html.php'; require_once dirname( __FILE__ ) . '/admin/hooks/post-thumbnail-html.php';
require_once dirname( __FILE__ ) . '/admin/hooks/restrict-manage-posts.php'; require_once dirname( __FILE__ ) . '/admin/hooks/restrict-manage-posts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/parse-query.php';
require_once dirname( __FILE__ ) . '/admin/hooks/save-post.php'; require_once dirname( __FILE__ ) . '/admin/hooks/save-post.php';
// Filters // Filters