SportsPress – Sports Club & League Manager - Version 2.7.1

Version Description

  • Feature - Enable player list filtering by nationality.
  • Feature - Add option to display date of birth in player lists.
  • Tweak - Exclude postponed and canceled events from countdowns.
  • Tweak - Apply reverse order option to event results.
  • Tweak - When a team has more than one home venue, separate with commas.
  • Fix - Venue address containing pluses in events.
  • Fix - Event blocks showing the wrong dates when embedded within other event pages.
  • Fix - Statistics not adding manual values when not based on equations.
  • Fix - Event lists ignoring the format parameter.
  • Fix - League table order when displaying multiple tables in team profiles.
  • Fix - Error when deleting configuration columns.
  • Fix - Player lists not including past players in some cases.
  • Fix - Prevent error when viewing event calendar in some cases.
Download this release

Release Info

Developer ThemeBoy
Plugin Icon 128x128 SportsPress – Sports Club & League Manager
Version 2.7.1
Comparing to
See all releases

Code changes from version 2.7 to 2.7.1

assets/js/sportspress.js CHANGED
@@ -10,7 +10,7 @@ function sp_viewport() {
10
  (function($) {
11
 
12
  /* Header */
13
- if ( ! $('.sp-header').size() ) {
14
  $('body').prepend( '<div class="sp-header sp-header-loaded"></div>' );
15
  }
16
 
@@ -116,4 +116,4 @@ function sp_viewport() {
116
  }
117
  });
118
 
119
- })(jQuery);
10
  (function($) {
11
 
12
  /* Header */
13
+ if ( ! $('.sp-header').length ) {
14
  $('body').prepend( '<div class="sp-header sp-header-loaded"></div>' );
15
  }
16
 
116
  }
117
  });
118
 
119
+ })(jQuery);
changelog.txt CHANGED
@@ -1,5 +1,20 @@
1
  == SportsPress Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 2.7 =
4
  * Feature - New bulk actions to postpone and cancel multiple events.
5
  * Feature - Add date of birth to player importer.
1
  == SportsPress Changelog ==
2
 
3
+ = 2.7.1 =
4
+ * Feature - Enable player list filtering by nationality.
5
+ * Feature - Add option to display date of birth in player lists.
6
+ * Tweak - Exclude postponed and canceled events from countdowns.
7
+ * Tweak - Apply reverse order option to event results.
8
+ * Tweak - When a team has more than one home venue, separate with commas.
9
+ * Fix - Venue address containing pluses in events.
10
+ * Fix - Event blocks showing the wrong dates when embedded within other event pages.
11
+ * Fix - Statistics not adding manual values when not based on equations.
12
+ * Fix - Event lists ignoring the format parameter.
13
+ * Fix - League table order when displaying multiple tables in team profiles.
14
+ * Fix - Error when deleting configuration columns.
15
+ * Fix - Player lists not including past players in some cases.
16
+ * Fix - Prevent error when viewing event calendar in some cases.
17
+
18
  = 2.7 =
19
  * Feature - New bulk actions to postpone and cancel multiple events.
20
  * Feature - Add date of birth to player importer.
includes/admin/importers/class-sp-event-importer.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Importers
8
- * @version 2.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -472,9 +472,14 @@ if ( class_exists( 'WP_Importer' ) ) {
472
  <td class="forminp forminp-radio" id="sp_formatdiv">
473
  <fieldset id="post-formats-select">
474
  <ul>
475
- <li><input type="radio" name="sp_format" class="post-format" id="post-format-league" value="league" checked="checked"> <label for="post-format-league" class="post-format-icon post-format-league"><?php _e( 'Competitive', 'sportspress' ); ?></label></li>
476
- <li><input type="radio" name="sp_format" class="post-format" id="post-format-friendly" value="friendly"> <label for="post-format-friendly" class="post-format-icon post-format-friendly"><?php _e( 'Friendly', 'sportspress' ); ?></label></li>
477
- <br>
 
 
 
 
 
478
  </fieldset>
479
  </td>
480
  </tr>
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Importers
8
+ * @version 2.7.1
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
472
  <td class="forminp forminp-radio" id="sp_formatdiv">
473
  <fieldset id="post-formats-select">
474
  <ul>
475
+ <?php
476
+ foreach( (new SP_Formats)->event as $name => $title ) {
477
+ ?>
478
+ <li><input type="radio" name="sp_format" class="post-format" id="post-format-<?php echo $name; ?>" value="<?php echo $name; ?>" checked="checked"> <label for="post-format-<?php echo $name; ?>" class="post-format-icon post-format-<?php echo $name; ?>"><?php echo $title; ?></label></li>
479
+ <?php
480
+ }
481
+ ?>
482
+ </ul>
483
  </fieldset>
484
  </td>
485
  </tr>
includes/admin/post-types/meta-boxes/class-sp-meta-box-list-columns.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
- * @version 2.1
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -48,6 +48,7 @@ class SP_Meta_Box_List_Columns {
48
  <?php _e( 'Position', 'sportspress' ); ?>
49
  </label>
50
  </li>
 
51
  </ul>
52
  <p><strong><?php _e( 'Data', 'sportspress' ); ?></strong></p>
53
  <div class="sp-instance">
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
+ * @version 2.7.1
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
48
  <?php _e( 'Position', 'sportspress' ); ?>
49
  </label>
50
  </li>
51
+ <?php do_action( 'sportspress_list_general_columns', $selected ); ?>
52
  </ul>
53
  <p><strong><?php _e( 'Data', 'sportspress' ); ?></strong></p>
54
  <div class="sp-instance">
includes/admin/post-types/meta-boxes/class-sp-meta-box-list-details.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
- * @version 2.5.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -34,6 +34,9 @@ class SP_Meta_Box_List_Details {
34
  $date_to = get_post_meta( $post->ID, 'sp_date_to', true );
35
  $date_past = get_post_meta( $post->ID, 'sp_date_past', true );
36
  $date_relative = get_post_meta( $post->ID, 'sp_date_relative', true );
 
 
 
37
  ?>
38
  <div>
39
  <p><strong><?php _e( 'Heading', 'sportspress' ); ?></strong></p>
@@ -98,6 +101,19 @@ class SP_Meta_Box_List_Details {
98
  <option value="past" <?php selected( 'past', $era ); ?>><?php _e( 'Past', 'sportspress' ); ?></option>
99
  </select>
100
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  <p><strong><?php _e( 'Grouping', 'sportspress' ); ?></strong></p>
102
  <p>
103
  <select name="sp_grouping">
@@ -143,7 +159,16 @@ class SP_Meta_Box_List_Details {
143
  </p>
144
  <?php
145
  if ( 'manual' == $select ) {
146
- sp_post_checklist( $post->ID, 'sp_player', ( 'auto' == $select ? 'none' : 'block' ), array( 'sp_league', 'sp_season', 'sp_current_team' ) );
 
 
 
 
 
 
 
 
 
147
  sp_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) );
148
  } else {
149
  ?>
@@ -178,5 +203,6 @@ class SP_Meta_Box_List_Details {
178
  update_post_meta( $post_id, 'sp_select', sp_array_value( $_POST, 'sp_select', array() ) );
179
  update_post_meta( $post_id, 'sp_number', sp_array_value( $_POST, 'sp_number', array() ) );
180
  sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
 
181
  }
182
- }
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
+ * @version 2.7.1
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
34
  $date_to = get_post_meta( $post->ID, 'sp_date_to', true );
35
  $date_past = get_post_meta( $post->ID, 'sp_date_past', true );
36
  $date_relative = get_post_meta( $post->ID, 'sp_date_relative', true );
37
+ $continents = SP()->countries->continents;
38
+ $nationalities = get_post_meta( $post->ID, 'sp_nationality', false );
39
+ $default_nationality = get_option( 'sportspress_default_nationality' , false );
40
  ?>
41
  <div>
42
  <p><strong><?php _e( 'Heading', 'sportspress' ); ?></strong></p>
101
  <option value="past" <?php selected( 'past', $era ); ?>><?php _e( 'Past', 'sportspress' ); ?></option>
102
  </select>
103
  </p>
104
+ <p><strong><?php _e( 'Nationality', 'sportspress' ); ?></strong></p>
105
+ <p>
106
+ <select id="sp_nationality" name="sp_nationality[]" data-placeholder="<?php printf( __( 'Select %s', 'sportspress' ), __( 'Nationality', 'sportspress' ) ); ?>" class="widefat chosen-select<?php if ( is_rtl() ): ?> chosen-rtl<?php endif; ?>" multiple="multiple">
107
+ <option value=""></option>
108
+ <?php foreach ( $continents as $continent => $countries ): ?>
109
+ <optgroup label="<?php echo $continent; ?>">
110
+ <?php foreach ( $countries as $code => $country ): ?>
111
+ <option value="<?php echo $code; ?>" <?php selected ( in_array( $code, $nationalities ) ); ?>><?php echo $country; ?></option>
112
+ <?php endforeach; ?>
113
+ </optgroup>
114
+ <?php endforeach; ?>
115
+ </select>
116
+ </p>
117
  <p><strong><?php _e( 'Grouping', 'sportspress' ); ?></strong></p>
118
  <p>
119
  <select name="sp_grouping">
159
  </p>
160
  <?php
161
  if ( 'manual' == $select ) {
162
+ $player_filters = array( 'sp_league', 'sp_season' );
163
+ if ( $team_id ) {
164
+ if ( in_array( $era, [ 'all', 'past' ] ) ) {
165
+ $player_filters[] = 'sp_past_team';
166
+ }
167
+ if ( in_array( $era, [ 'all', 'current' ] ) ) {
168
+ $player_filters[] = 'sp_current_team';
169
+ }
170
+ }
171
+ sp_post_checklist( $post->ID, 'sp_player', ( 'auto' == $select ? 'none' : 'block' ), $player_filters );
172
  sp_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) );
173
  } else {
174
  ?>
203
  update_post_meta( $post_id, 'sp_select', sp_array_value( $_POST, 'sp_select', array() ) );
204
  update_post_meta( $post_id, 'sp_number', sp_array_value( $_POST, 'sp_number', array() ) );
205
  sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
206
+ sp_update_post_meta_recursive( $post_id, 'sp_nationality', sp_array_value( $_POST, 'sp_nationality', array() ) );
207
  }
208
+ }
includes/class-sp-player-list.php CHANGED
@@ -5,7 +5,7 @@
5
  * The SportsPress player list class handles individual player list data.
6
  *
7
  * @class SP_Player_List
8
- * @version 2.7
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
@@ -59,6 +59,7 @@ class SP_Player_List extends SP_Secondary_Post {
59
  $crop = get_post_meta( $this->ID, 'sp_crop', true );
60
  $order = get_post_meta( $this->ID, 'sp_order', true );
61
  $select = get_post_meta( $this->ID, 'sp_select', true );
 
62
 
63
  $this->date = $this->__get( 'date' );
64
 
@@ -110,6 +111,9 @@ class SP_Player_List extends SP_Secondary_Post {
110
  'tax_query' => array(
111
  'relation' => 'AND',
112
  ),
 
 
 
113
  );
114
 
115
  if ( $league_ids ):
@@ -138,7 +142,7 @@ class SP_Player_List extends SP_Secondary_Post {
138
  $team_key = 'sp_past_team';
139
  break;
140
  endswitch;
141
- $args['meta_query'] = array(
142
  array(
143
  'key' => $team_key,
144
  'value' => $team
@@ -153,6 +157,16 @@ class SP_Player_List extends SP_Secondary_Post {
153
  'terms' => $position_ids
154
  );
155
  endif;
 
 
 
 
 
 
 
 
 
 
156
 
157
  $args = apply_filters( 'sportspress_player_list_args', $args, $team );
158
 
@@ -392,6 +406,8 @@ class SP_Player_List extends SP_Secondary_Post {
392
  $team_performance = get_post_meta( $event->ID, 'sp_players', true );
393
  $timeline = (array)get_post_meta( $event->ID, 'sp_timeline', true );
394
  $minutes = get_post_meta( $event->ID, 'sp_minutes', true );
 
 
395
  if ( $minutes === '' ) $minutes = get_option( 'sportspress_event_minutes', 90 );
396
 
397
  // Add all team performance
@@ -597,11 +613,13 @@ class SP_Player_List extends SP_Secondary_Post {
597
  endif;
598
  endif;
599
 
600
- if ( $placeholder !== '' && is_numeric( $placeholder ) ):
601
- $placeholder = sp_array_value( $placeholders[ $player_id ], $stat->post_name, 0 ) + $placeholder;
602
- else:
603
- $placeholder = sp_array_value( $placeholders[ $player_id ], $stat->post_name, '-' );
604
- endif;
 
 
605
 
606
  if ( is_numeric( $placeholder ) && $stat->precision ):
607
  $placeholder = number_format( $placeholder, $stat->precision, '.', '' );
@@ -614,6 +632,15 @@ class SP_Player_List extends SP_Secondary_Post {
614
 
615
  // Merge the data and placeholders arrays
616
  foreach( $placeholders as $player_id => $player_data ):
 
 
 
 
 
 
 
 
 
617
 
618
  $player_data = array_merge( $column_order, $player_data );
619
  $placeholders[ $player_id ] = $player_data;
@@ -701,6 +728,10 @@ class SP_Player_List extends SP_Secondary_Post {
701
  $labels[ $key ] = __( 'Team', 'sportspress' );
702
  elseif ( $key == 'position' ):
703
  $labels[ $key ] = __( 'Position', 'sportspress' );
 
 
 
 
704
  elseif ( array_key_exists( $key, $columns ) ):
705
  $labels[ $key ] = $columns[ $key ];
706
  endif;
@@ -750,6 +781,12 @@ class SP_Player_List extends SP_Secondary_Post {
750
  if ( in_array( 'position', $this->columns ) ) {
751
  $labels['position'] = __( 'Position', 'sportspress' );
752
  }
 
 
 
 
 
 
753
 
754
  $merged[0] = array_merge( $labels, $columns );
755
  return $merged;
5
  * The SportsPress player list class handles individual player list data.
6
  *
7
  * @class SP_Player_List
8
+ * @version 2.7.1
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
59
  $crop = get_post_meta( $this->ID, 'sp_crop', true );
60
  $order = get_post_meta( $this->ID, 'sp_order', true );
61
  $select = get_post_meta( $this->ID, 'sp_select', true );
62
+ $nationalities = get_post_meta( $this->ID, 'sp_nationality', false );
63
 
64
  $this->date = $this->__get( 'date' );
65
 
111
  'tax_query' => array(
112
  'relation' => 'AND',
113
  ),
114
+ 'meta_query' => array(
115
+ 'relation' => 'AND',
116
+ ),
117
  );
118
 
119
  if ( $league_ids ):
142
  $team_key = 'sp_past_team';
143
  break;
144
  endswitch;
145
+ $args['meta_query'][] = array(
146
  array(
147
  'key' => $team_key,
148
  'value' => $team
157
  'terms' => $position_ids
158
  );
159
  endif;
160
+
161
+ if ( $nationalities ):
162
+ $args['meta_query'][] = array(
163
+ array(
164
+ 'key' => 'sp_nationality',
165
+ 'value' => $nationalities,
166
+ 'compare' => 'IN'
167
+ ),
168
+ );
169
+ endif;
170
 
171
  $args = apply_filters( 'sportspress_player_list_args', $args, $team );
172
 
406
  $team_performance = get_post_meta( $event->ID, 'sp_players', true );
407
  $timeline = (array)get_post_meta( $event->ID, 'sp_timeline', true );
408
  $minutes = get_post_meta( $event->ID, 'sp_minutes', true );
409
+ $showdob = get_option( 'sportspress_player_show_birthday', 'no' );
410
+ $showage = get_option( 'sportspress_player_show_age', 'no' );
411
  if ( $minutes === '' ) $minutes = get_option( 'sportspress_event_minutes', 90 );
412
 
413
  // Add all team performance
613
  endif;
614
  endif;
615
 
616
+ if ( ! $stat->equation ) {
617
+ if ( $placeholder !== '' && is_numeric( $placeholder ) ):
618
+ $placeholder = sp_array_value( $placeholders[ $player_id ], $stat->post_name, 0 ) + $placeholder;
619
+ else:
620
+ $placeholder = sp_array_value( $placeholders[ $player_id ], $stat->post_name, '-' );
621
+ endif;
622
+ }
623
 
624
  if ( is_numeric( $placeholder ) && $stat->precision ):
625
  $placeholder = number_format( $placeholder, $stat->precision, '.', '' );
632
 
633
  // Merge the data and placeholders arrays
634
  foreach( $placeholders as $player_id => $player_data ):
635
+
636
+ if ( in_array( 'dob', $this->columns ) ):
637
+ $player_data['dob'] = get_the_date( get_option( 'date_format') , $player_id );
638
+ endif;
639
+
640
+ if ( in_array( 'age', $this->columns ) ):
641
+ $birthdayclass = new SportsPress_Birthdays();
642
+ $player_data['age'] = $birthdayclass->get_age( get_the_date( 'm-d-Y', $player_id ) );
643
+ endif;
644
 
645
  $player_data = array_merge( $column_order, $player_data );
646
  $placeholders[ $player_id ] = $player_data;
728
  $labels[ $key ] = __( 'Team', 'sportspress' );
729
  elseif ( $key == 'position' ):
730
  $labels[ $key ] = __( 'Position', 'sportspress' );
731
+ elseif ( $key == 'dob' && $showdob ):
732
+ $labels[ $key ] = __( 'Date of Birth', 'sportspress' );
733
+ elseif ( $key == 'age' && $showage ):
734
+ $labels[ $key ] = __( 'Age', 'sportspress' );
735
  elseif ( array_key_exists( $key, $columns ) ):
736
  $labels[ $key ] = $columns[ $key ];
737
  endif;
781
  if ( in_array( 'position', $this->columns ) ) {
782
  $labels['position'] = __( 'Position', 'sportspress' );
783
  }
784
+ if ( in_array( 'dob', $this->columns ) && $showdob ) {
785
+ $labels['dob'] = __( 'Date of Birth', 'sportspress' );
786
+ }
787
+ if ( in_array( 'age', $this->columns ) && $showage ) {
788
+ $labels['age'] = __( 'Age', 'sportspress' );
789
+ }
790
 
791
  $merged[0] = array_merge( $labels, $columns );
792
  return $merged;
includes/class-sp-post-types.php CHANGED
@@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) {
9
  * Registers post types and taxonomies
10
  *
11
  * @class SP_Post_types
12
- * @version 2.7
13
  * @package SportsPress/Classes
14
  * @category Class
15
  * @author ThemeBoy
@@ -22,7 +22,7 @@ class SP_Post_types {
22
  public function __construct() {
23
  add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 );
24
  add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 10 );
25
- add_action( 'wp_trash_post', array( $this, 'delete_config_post' ) );
26
  add_filter( 'the_posts', array( $this, 'display_scheduled_events' ) );
27
  }
28
 
9
  * Registers post types and taxonomies
10
  *
11
  * @class SP_Post_types
12
+ * @version 2.7.1
13
  * @package SportsPress/Classes
14
  * @category Class
15
  * @author ThemeBoy
22
  public function __construct() {
23
  add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 );
24
  add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 10 );
25
+ add_action( 'trashed_post', array( $this, 'delete_config_post' ) );
26
  add_filter( 'the_posts', array( $this, 'display_scheduled_events' ) );
27
  }
28
 
includes/class-sp-team.php CHANGED
@@ -5,7 +5,7 @@
5
  * The SportsPress team class handles individual team data.
6
  *
7
  * @class SP_Team
8
- * @version 2.6.3
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
@@ -488,7 +488,7 @@ class SP_Team extends SP_Custom_Post {
488
  );
489
  $tables_by_terms = get_posts( $args );
490
 
491
- $tables = array_merge( $tables_by_id, $tables_by_terms );
492
 
493
  $checked = (array) get_post_meta( $this->ID, 'sp_table' );
494
 
5
  * The SportsPress team class handles individual team data.
6
  *
7
  * @class SP_Team
8
+ * @version 2.7.1
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
488
  );
489
  $tables_by_terms = get_posts( $args );
490
 
491
+ $tables = array_merge( $tables_by_terms, $tables_by_id );
492
 
493
  $checked = (array) get_post_meta( $this->ID, 'sp_table' );
494
 
modules/sportspress-birthdays.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
5
  Description: Add birthdays to players and staff.
6
  Author: ThemeBoy
7
  Author URI: http://themeboy.com/
8
- Version: 2.5
9
  */
10
 
11
  // Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Birthdays' ) ) :
17
  * Main SportsPress Birthdays Class
18
  *
19
  * @class SportsPress_Birthdays
20
- * @version 2.5
21
  */
22
  class SportsPress_Birthdays {
23
 
@@ -36,6 +36,7 @@ class SportsPress_Birthdays {
36
  add_filter( 'sportspress_staff_details', array( $this, 'add_staff_details' ), 20, 2 );
37
 
38
  add_action( 'sportspress_widgets', array( $this, 'widgets' ) );
 
39
  }
40
 
41
  /**
@@ -43,7 +44,7 @@ class SportsPress_Birthdays {
43
  */
44
  private function define_constants() {
45
  if ( !defined( 'SP_BIRTHDAYS_VERSION' ) )
46
- define( 'SP_BIRTHDAYS_VERSION', '2.5' );
47
 
48
  if ( !defined( 'SP_BIRTHDAYS_URL' ) )
49
  define( 'SP_BIRTHDAYS_URL', plugin_dir_url( __FILE__ ) );
@@ -187,6 +188,26 @@ class SportsPress_Birthdays {
187
  public static function widgets() {
188
  include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-birthdays.php' );
189
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
  /**
192
  * Get age from date.
5
  Description: Add birthdays to players and staff.
6
  Author: ThemeBoy
7
  Author URI: http://themeboy.com/
8
+ Version: 2.7.1
9
  */
10
 
11
  // Exit if accessed directly
17
  * Main SportsPress Birthdays Class
18
  *
19
  * @class SportsPress_Birthdays
20
+ * @version 2.7.1
21
  */
22
  class SportsPress_Birthdays {
23
 
36
  add_filter( 'sportspress_staff_details', array( $this, 'add_staff_details' ), 20, 2 );
37
 
38
  add_action( 'sportspress_widgets', array( $this, 'widgets' ) );
39
+ add_action( 'sportspress_list_general_columns', array( $this, 'columns' ), 10, 1 );
40
  }
41
 
42
  /**
44
  */
45
  private function define_constants() {
46
  if ( !defined( 'SP_BIRTHDAYS_VERSION' ) )
47
+ define( 'SP_BIRTHDAYS_VERSION', '2.7.1' );
48
 
49
  if ( !defined( 'SP_BIRTHDAYS_URL' ) )
50
  define( 'SP_BIRTHDAYS_URL', plugin_dir_url( __FILE__ ) );
188
  public static function widgets() {
189
  include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-birthdays.php' );
190
  }
191
+
192
+ /**
193
+ * Add more General Columns at Player Lists
194
+ */
195
+ public static function columns( $selected ) {
196
+ ?>
197
+ <li>
198
+ <label class="selectit">
199
+ <input value="dob" type="checkbox" name="sp_columns[]" id="sp_columns_dob" <?php checked( in_array( 'dob', $selected ) ); ?>>
200
+ <?php _e( 'Date of Birth', 'sportspress' ); ?>
201
+ </label>
202
+ </li>
203
+ <li>
204
+ <label class="selectit">
205
+ <input value="age" type="checkbox" name="sp_columns[]" id="sp_columns_age" <?php checked( in_array( 'age', $selected ) ); ?>>
206
+ <?php _e( 'Age', 'sportspress' ); ?>
207
+ </label>
208
+ </li>
209
+ <?php
210
+ }
211
 
212
  /**
213
  * Get age from date.
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === SportsPress - Sports Club & League Manager ===
2
- Contributors: ThemeBoy, brianmiyaji, aylaview, savvasha, nabil_kadimi
3
  Tags: calendars, club, club management, esports, events, fixtures, leagues, league management, sports, sports club, sports data, team rosters
4
  Donate link: http://tboy.co/donate
5
  Requires at least: 3.8
6
  Tested up to: 5.3
7
- Stable tag: 2.7
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -240,6 +240,21 @@ When you upgrade to one of the SportsPress Pro licenses, you can simply activate
240
 
241
  == Changelog ==
242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  = 2.7 =
244
  * Feature - New bulk actions to postpone and cancel multiple events.
245
  * Feature - Add date of birth to player importer.
1
  === SportsPress - Sports Club & League Manager ===
2
+ Contributors: ThemeBoy, brianmiyaji, aylaview, savvasha, nabil_kadimi, rochesterj
3
  Tags: calendars, club, club management, esports, events, fixtures, leagues, league management, sports, sports club, sports data, team rosters
4
  Donate link: http://tboy.co/donate
5
  Requires at least: 3.8
6
  Tested up to: 5.3
7
+ Stable tag: 2.7.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
240
 
241
  == Changelog ==
242
 
243
+ = 2.7.1 =
244
+ * Feature - Enable player list filtering by nationality.
245
+ * Feature - Add option to display date of birth in player lists.
246
+ * Tweak - Exclude postponed and canceled events from countdowns.
247
+ * Tweak - Apply reverse order option to event results.
248
+ * Tweak - When a team has more than one home venue, separate with commas.
249
+ * Fix - Venue address containing pluses in events.
250
+ * Fix - Event blocks showing the wrong dates when embedded within other event pages.
251
+ * Fix - Statistics not adding manual values when not based on equations.
252
+ * Fix - Event lists ignoring the format parameter.
253
+ * Fix - League table order when displaying multiple tables in team profiles.
254
+ * Fix - Error when deleting configuration columns.
255
+ * Fix - Player lists not including past players in some cases.
256
+ * Fix - Prevent error when viewing event calendar in some cases.
257
+
258
  = 2.7 =
259
  * Feature - New bulk actions to postpone and cancel multiple events.
260
  * Feature - Add date of birth to player importer.
sportspress.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: SportsPress
4
  * Plugin URI: http://themeboy.com/sportspress/
5
  * Description: Manage your club and its players, staff, events, league tables, and player lists.
6
- * Version: 2.7
7
  * Author: ThemeBoy
8
  * Author URI: http://themeboy.com
9
  * Requires at least: 3.8
@@ -26,14 +26,14 @@ if ( ! class_exists( 'SportsPress' ) ) :
26
  * Main SportsPress Class
27
  *
28
  * @class SportsPress
29
- * @version 2.7
30
  */
31
  final class SportsPress {
32
 
33
  /**
34
  * @var string
35
  */
36
- public $version = '2.7';
37
 
38
  /**
39
  * @var SportsPress The single instance of the class
3
  * Plugin Name: SportsPress
4
  * Plugin URI: http://themeboy.com/sportspress/
5
  * Description: Manage your club and its players, staff, events, league tables, and player lists.
6
+ * Version: 2.7.1
7
  * Author: ThemeBoy
8
  * Author URI: http://themeboy.com
9
  * Requires at least: 3.8
26
  * Main SportsPress Class
27
  *
28
  * @class SportsPress
29
+ * @version 2.7.1
30
  */
31
  final class SportsPress {
32
 
33
  /**
34
  * @var string
35
  */
36
+ public $version = '2.7.1';
37
 
38
  /**
39
  * @var SportsPress The single instance of the class
templates/countdown.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.6.12
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -30,10 +30,22 @@ elseif ( $calendar ):
30
  if ( $team )
31
  $calendar->team = $team;
32
  $calendar->status = 'future';
33
- $calendar->number = 1;
34
  $calendar->order = 'ASC';
35
  $data = $calendar->data();
36
- $post = array_shift( $data );
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  else:
38
  $args = array();
39
  if ( isset( $team ) ) {
@@ -61,6 +73,19 @@ else:
61
  );
62
  }
63
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  $post = sp_get_next_event( $args );
65
  endif;
66
 
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.7.1
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
30
  if ( $team )
31
  $calendar->team = $team;
32
  $calendar->status = 'future';
 
33
  $calendar->order = 'ASC';
34
  $data = $calendar->data();
35
+
36
+ /**
37
+ * Exclude postponed or cancelled events.
38
+ */
39
+ $excluded_statuses = apply_filters( 'sp_countdown_excluded_statuses', array(
40
+ 'postponed',
41
+ 'cancelled',
42
+ ) );
43
+ while ( $post = array_shift( $data ) ) {
44
+ $sp_status = get_post_meta($post->ID, 'sp_status', true);
45
+ if( ! in_array( $sp_status, $excluded_statuses ) ) {
46
+ break;
47
+ }
48
+ }
49
  else:
50
  $args = array();
51
  if ( isset( $team ) ) {
73
  );
74
  }
75
  }
76
+
77
+ /**
78
+ * Exclude postponed or cancelled events.
79
+ */
80
+ $args['meta_query'][] = [
81
+ 'key' => 'sp_status',
82
+ 'compare' => 'NOT IN',
83
+ 'value' => apply_filters( 'sp_countdown_excluded_statuses', array(
84
+ 'postponed',
85
+ 'cancelled',
86
+ ) ),
87
+ ];
88
+
89
  $post = sp_get_next_event( $args );
90
  endif;
91
 
templates/event-calendar.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.5.5
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -183,10 +183,11 @@ if ( $dayswithposts ) {
183
  $daywithpost = array();
184
  }
185
 
186
- if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'camino') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false)
187
  $ak_title_separator = "\n";
188
- else
189
  $ak_title_separator = ', ';
 
190
 
191
  $ak_titles_for_day = array();
192
  $ak_post_titles = $wpdb->get_results("SELECT ID, post_title, post_date, DAYOFMONTH(post_date) as dom "
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.7.1
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
183
  $daywithpost = array();
184
  }
185
 
186
+ if ( array_key_exists( 'HTTP_USER_AGENT', $_SERVER ) && preg_match( '/(MSIE|camino|safari)/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
187
  $ak_title_separator = "\n";
188
+ } else {
189
  $ak_title_separator = ', ';
190
+ }
191
 
192
  $ak_titles_for_day = array();
193
  $ak_post_titles = $wpdb->get_results("SELECT ID, post_title, post_date, DAYOFMONTH(post_date) as dom "
templates/event-list.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.6.19
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -51,7 +51,7 @@ extract( $defaults, EXTR_SKIP );
51
  $calendar = new SP_Calendar( $id );
52
  if ( $status != 'default' )
53
  $calendar->status = $status;
54
- if ( $format != 'default' )
55
  $calendar->event_format = $format;
56
  if ( $date != 'default' )
57
  $calendar->date = $date;
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.7.1
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
51
  $calendar = new SP_Calendar( $id );
52
  if ( $status != 'default' )
53
  $calendar->status = $status;
54
+ if ( $format != 'all' )
55
  $calendar->event_format = $format;
56
  if ( $date != 'default' )
57
  $calendar->date = $date;
templates/event-logos-block.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.6
8
  */
9
  ?>
10
  <div class="sp-template sp-template-event-logos sp-template-event-blocks sp-template-event-logos-block">
@@ -42,8 +42,8 @@
42
  echo $logo;
43
  endforeach;
44
  ?>
45
- <time class="sp-event-date" datetime="<?php echo get_the_time( 'Y-m-d H:i:s' ); ?>">
46
- <?php echo get_the_time( get_option( 'date_format' ) ); ?>
47
  </time>
48
  <?php
49
 
@@ -74,4 +74,4 @@
74
  </tbody>
75
  </table>
76
  </div>
77
- </div>
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.7.1
8
  */
9
  ?>
10
  <div class="sp-template sp-template-event-logos sp-template-event-blocks sp-template-event-logos-block">
42
  echo $logo;
43
  endforeach;
44
  ?>
45
+ <time class="sp-event-date" datetime="<?php echo get_the_time( 'Y-m-d H:i:s', $id ); ?>">
46
+ <?php echo get_the_time( get_option( 'date_format' ), $id ); ?>
47
  </time>
48
  <?php
49
 
74
  </tbody>
75
  </table>
76
  </div>
77
+ </div>
templates/event-results.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -43,6 +43,12 @@ $output = '';
43
  $table_rows = '';
44
  $i = 0;
45
 
 
 
 
 
 
 
46
  foreach( $data as $team_id => $result ):
47
  if ( $show_outcomes ):
48
  $outcomes = array();
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.7.1
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
43
  $table_rows = '';
44
  $i = 0;
45
 
46
+ // Reverse teams order if the option "Events > Teams > Order > Reverse order" is enabled.
47
+ $reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
48
+ if ( $reverse_teams ) {
49
+ $data = array_reverse( $data, true );
50
+ }
51
+
52
  foreach( $data as $team_id => $result ):
53
  if ( $show_outcomes ):
54
  $outcomes = array();
templates/event-venue.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.7
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -47,7 +47,7 @@ foreach( $venues as $venue ):
47
  </tr>
48
  <?php if ( $address != null ) { ?>
49
  <tr class="sp-event-venue-address-row">
50
- <td><?php echo $address; ?></td>
51
  </tr>
52
  <?php } ?>
53
  </tbody>
@@ -56,4 +56,4 @@ foreach( $venues as $venue ):
56
  </div>
57
  <?php
58
  endforeach;
59
- ?>
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.7.1
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
47
  </tr>
48
  <?php if ( $address != null ) { ?>
49
  <tr class="sp-event-venue-address-row">
50
+ <td><?php echo urldecode( $address ); ?></td>
51
  </tr>
52
  <?php } ?>
53
  </tbody>
56
  </div>
57
  <?php
58
  endforeach;
59
+ ?>
templates/player-list.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.6.15
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -55,7 +55,8 @@ $list = new SP_Player_List( $id );
55
  if ( isset( $columns ) && null !== $columns ):
56
  $list->columns = $columns;
57
  endif;
58
- $data = $list->data( false, $leagues, $seasons, $team );
 
59
 
60
  // The first row should be labels
61
  $labels = $data[0];
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.7.1
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
55
  if ( isset( $columns ) && null !== $columns ):
56
  $list->columns = $columns;
57
  endif;
58
+
59
+ $data = apply_filters('sportspress_player_list_data', $list->data( false, $leagues, $seasons, $team ) , $id );
60
 
61
  // The first row should be labels
62
  $labels = $data[0];
templates/team-details.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.5
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -36,7 +36,7 @@ endif;
36
  $terms = get_the_terms( $id, 'sp_venue' );
37
  if ( $terms ):
38
  if ( get_option( 'sportspress_team_link_venues', 'no' ) === 'yes' ):
39
- $data[ __( 'Home', 'sportspress' ) ] = get_the_term_list( $id, 'sp_venue' );
40
  else:
41
  $venues = array();
42
  foreach ( $terms as $term ):
@@ -59,4 +59,4 @@ $output .= '</dl></div>';
59
  ?>
60
  <div class="sp-template sp-template-team-details sp-template-details">
61
  <?php echo $output; ?>
62
- </div>
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.7.1
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
36
  $terms = get_the_terms( $id, 'sp_venue' );
37
  if ( $terms ):
38
  if ( get_option( 'sportspress_team_link_venues', 'no' ) === 'yes' ):
39
+ $data[ __( 'Home', 'sportspress' ) ] = get_the_term_list( $id, 'sp_venue', '', ', ' );
40
  else:
41
  $venues = array();
42
  foreach ( $terms as $term ):
59
  ?>
60
  <div class="sp-template sp-template-team-details sp-template-details">
61
  <?php echo $output; ?>
62
+ </div>