Version Description
- Tweak - Add option to display birthday, age, or both in birthdays widget.
- Fix - Player list data showing zeroes in some cases.
Download this release
Release Info
Developer | ThemeBoy |
Plugin | SportsPress – Sports Club & League Manager |
Version | 2.7.4 |
Comparing to | |
See all releases |
Code changes from version 2.7.3 to 2.7.4
- assets/js/admin/sportspress-admin.js +1 -1
- changelog.txt +4 -0
- includes/class-sp-player-list.php +3 -10
- includes/sp-core-functions.php +2 -0
- includes/widgets/class-sp-widget-birthdays.php +25 -8
- readme.txt +5 -1
- sportspress.php +3 -3
- templates/birthdays.php +26 -13
assets/js/admin/sportspress-admin.js
CHANGED
@@ -258,7 +258,7 @@ jQuery(document).ready(function($){
|
|
258 |
});
|
259 |
|
260 |
// Activate total stats calculator
|
261 |
-
if($(".sp-data-table .sp-total").
|
262 |
$(".sp-data-table .sp-post td input").on("keyup", function() {
|
263 |
$(this).closest(".sp-data-table").find(".sp-total td").eq($(this).parent().index()).find("input[data-sp-format=number][data-sp-total-type!=average]").trigger("updateTotal");
|
264 |
});
|
258 |
});
|
259 |
|
260 |
// Activate total stats calculator
|
261 |
+
if($(".sp-data-table .sp-total").length) {
|
262 |
$(".sp-data-table .sp-post td input").on("keyup", function() {
|
263 |
$(this).closest(".sp-data-table").find(".sp-total td").eq($(this).parent().index()).find("input[data-sp-format=number][data-sp-total-type!=average]").trigger("updateTotal");
|
264 |
});
|
changelog.txt
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
== SportsPress Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
3 |
= 2.7.3 =
|
4 |
* Compatibility - Tested for compatibility with WordPress 5.5 with changes made where necessary.
|
5 |
* Tweak - Avoid showing minutes box for subs when not needed.
|
1 |
== SportsPress Changelog ==
|
2 |
|
3 |
+
= 2.7.4 =
|
4 |
+
* Tweak - Add option to display birthday, age, or both in birthdays widget.
|
5 |
+
* Fix - Player list data showing zeroes in some cases.
|
6 |
+
|
7 |
= 2.7.3 =
|
8 |
* Compatibility - Tested for compatibility with WordPress 5.5 with changes made where necessary.
|
9 |
* Tweak - Avoid showing minutes box for subs when not needed.
|
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
|
@@ -377,18 +377,11 @@ class SP_Player_List extends SP_Secondary_Post {
|
|
377 |
|
378 |
$team_key = 'sp_team';
|
379 |
if ( $team ):
|
380 |
-
switch ( $era ):
|
381 |
-
case 'current':
|
382 |
-
$team_key = 'sp_current_team';
|
383 |
-
break;
|
384 |
-
case 'past':
|
385 |
-
$team_key = 'sp_past_team';
|
386 |
-
break;
|
387 |
-
endswitch;
|
388 |
$args['meta_query'][] = array(
|
389 |
array(
|
390 |
'key' => $team_key,
|
391 |
-
'value' => $team
|
|
|
392 |
),
|
393 |
);
|
394 |
endif;
|
5 |
* The SportsPress player list class handles individual player list data.
|
6 |
*
|
7 |
* @class SP_Player_List
|
8 |
+
* @version 2.7.4
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
377 |
|
378 |
$team_key = 'sp_team';
|
379 |
if ( $team ):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
$args['meta_query'][] = array(
|
381 |
array(
|
382 |
'key' => $team_key,
|
383 |
+
'value' => $team,
|
384 |
+
'compare' => 'IN',
|
385 |
),
|
386 |
);
|
387 |
endif;
|
includes/sp-core-functions.php
CHANGED
@@ -1580,6 +1580,7 @@ function sp_get_text_options() {
|
|
1580 |
__( 'Full Time', 'sportspress' ),
|
1581 |
__( 'Home', 'sportspress' ),
|
1582 |
__( 'League', 'sportspress' ),
|
|
|
1583 |
__( 'League Table', 'sportspress' ),
|
1584 |
__( 'Match Day', 'sportspress' ),
|
1585 |
__( 'Nationality', 'sportspress' ),
|
@@ -1599,6 +1600,7 @@ function sp_get_text_options() {
|
|
1599 |
__( 'Recap', 'sportspress' ),
|
1600 |
__( 'Results', 'sportspress' ),
|
1601 |
__( 'Season', 'sportspress' ),
|
|
|
1602 |
__( 'Staff', 'sportspress' ),
|
1603 |
__( 'Statistics', 'sportspress' ),
|
1604 |
__( 'TBD', 'sportspress' ),
|
1580 |
__( 'Full Time', 'sportspress' ),
|
1581 |
__( 'Home', 'sportspress' ),
|
1582 |
__( 'League', 'sportspress' ),
|
1583 |
+
__( 'Leagues', 'sportspress' ),
|
1584 |
__( 'League Table', 'sportspress' ),
|
1585 |
__( 'Match Day', 'sportspress' ),
|
1586 |
__( 'Nationality', 'sportspress' ),
|
1600 |
__( 'Recap', 'sportspress' ),
|
1601 |
__( 'Results', 'sportspress' ),
|
1602 |
__( 'Season', 'sportspress' ),
|
1603 |
+
__( 'Seasons', 'sportspress' ),
|
1604 |
__( 'Staff', 'sportspress' ),
|
1605 |
__( 'Statistics', 'sportspress' ),
|
1606 |
__( 'TBD', 'sportspress' ),
|
includes/widgets/class-sp-widget-birthdays.php
CHANGED
@@ -8,8 +8,9 @@ class SP_Widget_Birthdays extends WP_Widget {
|
|
8 |
|
9 |
function widget( $args, $instance ) {
|
10 |
extract($args);
|
11 |
-
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
|
12 |
-
$date = empty($instance['date']) ? 'day' : strip_tags($instance['date']);
|
|
|
13 |
|
14 |
do_action( 'sportspress_before_widget', $args, $instance, 'birthdays' );
|
15 |
echo $before_widget;
|
@@ -20,7 +21,7 @@ class SP_Widget_Birthdays extends WP_Widget {
|
|
20 |
// Action to hook into
|
21 |
do_action( 'sportspress_before_widget_template', $args, $instance, 'birthdays' );
|
22 |
|
23 |
-
sp_get_template( 'birthdays.php', array( 'date' => $date ) );
|
24 |
|
25 |
// Action to hook into
|
26 |
do_action( 'sportspress_after_widget_template', $args, $instance, 'birthdays' );
|
@@ -31,8 +32,9 @@ class SP_Widget_Birthdays extends WP_Widget {
|
|
31 |
|
32 |
function update( $new_instance, $old_instance ) {
|
33 |
$instance = $old_instance;
|
34 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
35 |
-
$instance['date'] = strip_tags($new_instance['date']);
|
|
|
36 |
|
37 |
// Filter to hook into
|
38 |
$instance = apply_filters( 'sportspress_widget_update', $instance, $new_instance, $old_instance, 'birthdays' );
|
@@ -41,14 +43,21 @@ class SP_Widget_Birthdays extends WP_Widget {
|
|
41 |
}
|
42 |
|
43 |
function form( $instance ) {
|
44 |
-
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'date' => 'day' ) );
|
45 |
-
$title = strip_tags($instance['title']);
|
46 |
-
$date = strip_tags($instance['date']);
|
47 |
$options = array(
|
48 |
'day' => __( 'Today', 'sportspress' ),
|
49 |
'week' => __( 'This week', 'sportspress' ),
|
50 |
'month' => __( 'This month', 'sportspress' ),
|
51 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
// Action to hook into
|
54 |
do_action( 'sportspress_before_widget_template_form', $this, $instance, 'birthdays' );
|
@@ -64,6 +73,14 @@ class SP_Widget_Birthdays extends WP_Widget {
|
|
64 |
<?php } ?>
|
65 |
</select>
|
66 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
<?php
|
68 |
// Action to hook into
|
69 |
do_action( 'sportspress_after_widget_template_form', $this, $instance, 'birthdays' );
|
8 |
|
9 |
function widget( $args, $instance ) {
|
10 |
extract($args);
|
11 |
+
$title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base );
|
12 |
+
$date = empty( $instance['date']) ? 'day' : strip_tags($instance['date'] );
|
13 |
+
$birthday_format = empty( $instance['birthday_format']) ? 'birthday' : strip_tags( $instance['birthday_format'] );
|
14 |
|
15 |
do_action( 'sportspress_before_widget', $args, $instance, 'birthdays' );
|
16 |
echo $before_widget;
|
21 |
// Action to hook into
|
22 |
do_action( 'sportspress_before_widget_template', $args, $instance, 'birthdays' );
|
23 |
|
24 |
+
sp_get_template( 'birthdays.php', array( 'date' => $date, 'birthday_format' => $birthday_format ) );
|
25 |
|
26 |
// Action to hook into
|
27 |
do_action( 'sportspress_after_widget_template', $args, $instance, 'birthdays' );
|
32 |
|
33 |
function update( $new_instance, $old_instance ) {
|
34 |
$instance = $old_instance;
|
35 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
36 |
+
$instance['date'] = strip_tags( $new_instance['date'] );
|
37 |
+
$instance['birthday_format'] = strip_tags( $new_instance['birthday_format'] );
|
38 |
|
39 |
// Filter to hook into
|
40 |
$instance = apply_filters( 'sportspress_widget_update', $instance, $new_instance, $old_instance, 'birthdays' );
|
43 |
}
|
44 |
|
45 |
function form( $instance ) {
|
46 |
+
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'date' => 'day', 'birthday_format' => 'birthday' ) );
|
47 |
+
$title = strip_tags( $instance['title'] );
|
48 |
+
$date = strip_tags( $instance['date'] );
|
49 |
$options = array(
|
50 |
'day' => __( 'Today', 'sportspress' ),
|
51 |
'week' => __( 'This week', 'sportspress' ),
|
52 |
'month' => __( 'This month', 'sportspress' ),
|
53 |
);
|
54 |
+
$birthday_format = strip_tags( $instance['birthday_format'] );
|
55 |
+
$birthday_options = array(
|
56 |
+
'hide' => __( 'Hide', 'sportspress' ),
|
57 |
+
'birthday' => __( 'Birthday', 'sportspress' ),
|
58 |
+
'age' => __( 'Age', 'sportspress' ),
|
59 |
+
'birthdayage' => __( 'Birthday (Age)', 'sportspress' ),
|
60 |
+
);
|
61 |
|
62 |
// Action to hook into
|
63 |
do_action( 'sportspress_before_widget_template_form', $this, $instance, 'birthdays' );
|
73 |
<?php } ?>
|
74 |
</select>
|
75 |
</p>
|
76 |
+
<p>
|
77 |
+
<label for="<?php echo $this->get_field_id('birthday_format'); ?>"><?php _e( 'Format:', 'sportspress' ); ?></label>
|
78 |
+
<select name="<?php echo $this->get_field_name('birthday_format'); ?>" id="<?php echo $this->get_field_id('birthday_format'); ?>" class="postform widefat">
|
79 |
+
<?php foreach ( $birthday_options as $value => $label ) { ?>
|
80 |
+
<option value="<?php echo $value; ?>" <?php selected( $value, $birthday_format ); ?>><?php echo $label; ?></option>
|
81 |
+
<?php } ?>
|
82 |
+
</select>
|
83 |
+
</p>
|
84 |
<?php
|
85 |
// Action to hook into
|
86 |
do_action( 'sportspress_after_widget_template_form', $this, $instance, 'birthdays' );
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: calendars, club, club management, esports, events, fixtures, leagues, leag
|
|
4 |
Donate link: http://tboy.co/donate
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.5
|
7 |
-
Stable tag: 2.7.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -240,6 +240,10 @@ When you upgrade to one of the SportsPress Pro licenses, you can simply activate
|
|
240 |
|
241 |
== Changelog ==
|
242 |
|
|
|
|
|
|
|
|
|
243 |
= 2.7.3 =
|
244 |
* Compatibility - Tested for compatibility with WordPress 5.5 with changes made where necessary.
|
245 |
* Tweak - Avoid showing minutes box for subs when not needed.
|
4 |
Donate link: http://tboy.co/donate
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.5
|
7 |
+
Stable tag: 2.7.4
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
240 |
|
241 |
== Changelog ==
|
242 |
|
243 |
+
= 2.7.4 =
|
244 |
+
* Tweak - Add option to display birthday, age, or both in birthdays widget.
|
245 |
+
* Fix - Player list data showing zeroes in some cases.
|
246 |
+
|
247 |
= 2.7.3 =
|
248 |
* Compatibility - Tested for compatibility with WordPress 5.5 with changes made where necessary.
|
249 |
* Tweak - Avoid showing minutes box for subs when not needed.
|
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.4
|
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.4
|
30 |
*/
|
31 |
final class SportsPress {
|
32 |
|
33 |
/**
|
34 |
* @var string
|
35 |
*/
|
36 |
+
public $version = '2.7.4';
|
37 |
|
38 |
/**
|
39 |
* @var SportsPress The single instance of the class
|
templates/birthdays.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress_Birthdays
|
7 |
-
* @version 2.
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -16,6 +16,7 @@ $defaults = array(
|
|
16 |
'icontag' => 'dt',
|
17 |
'captiontag' => 'dd',
|
18 |
'size' => 'sportspress-fit-medium',
|
|
|
19 |
'show_player_birthday' => get_option( 'sportspress_player_show_birthday', 'no' ) == 'yes' ? true : false,
|
20 |
'show_staff_birthday' => get_option( 'sportspress_staff_show_birthday', 'no' ) == 'yes' ? true : false,
|
21 |
'link_players' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
@@ -91,24 +92,36 @@ foreach ( $posts as $post ) {
|
|
91 |
|
92 |
$birthday = get_the_date( get_option( 'date_format') , $post->ID );
|
93 |
|
94 |
-
|
95 |
-
|
|
|
96 |
}
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
echo '<div class="gallery">';
|
99 |
|
100 |
$caption = $post->post_title;
|
101 |
$caption = trim( $caption );
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
|
113 |
echo '<br style="clear: both;" />';
|
114 |
echo "</div></div>\n";
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress_Birthdays
|
7 |
+
* @version 2.7.4
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
16 |
'icontag' => 'dt',
|
17 |
'captiontag' => 'dd',
|
18 |
'size' => 'sportspress-fit-medium',
|
19 |
+
'birthday_format' => 'birthday',
|
20 |
'show_player_birthday' => get_option( 'sportspress_player_show_birthday', 'no' ) == 'yes' ? true : false,
|
21 |
'show_staff_birthday' => get_option( 'sportspress_staff_show_birthday', 'no' ) == 'yes' ? true : false,
|
22 |
'link_players' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
92 |
|
93 |
$birthday = get_the_date( get_option( 'date_format') , $post->ID );
|
94 |
|
95 |
+
$heading = null;
|
96 |
+
if ( ( $show_birthday || 'birthday' == $birthday_format ) && $birthday && 'hide' != $birthday_format ) {
|
97 |
+
$heading = '<h4 class="sp-table-caption">' . $birthday . '</h4>';
|
98 |
}
|
99 |
+
if ( 'age' == $birthday_format && $birthday ) {
|
100 |
+
$sp_birthdays = new SportsPress_Birthdays();
|
101 |
+
$age = $sp_birthdays->get_age( get_the_date( 'm-d-Y', $post->ID ) );
|
102 |
+
$heading = '<h4 class="sp-table-caption">' . $age . '</h4>';
|
103 |
+
}
|
104 |
+
if ( 'birthdayage' == $birthday_format && $birthday ) {
|
105 |
+
$sp_birthdays = new SportsPress_Birthdays();
|
106 |
+
$age = $sp_birthdays->get_age( get_the_date( 'm-d-Y', $post->ID ) );
|
107 |
+
$heading = '<h4 class="sp-table-caption">' . $birthday . ' (' . $age . ')</h4>';
|
108 |
+
}
|
109 |
+
echo $heading;
|
110 |
+
|
111 |
echo '<div class="gallery">';
|
112 |
|
113 |
$caption = $post->post_title;
|
114 |
$caption = trim( $caption );
|
115 |
|
116 |
+
sp_get_template( 'player-gallery-thumbnail.php', array(
|
117 |
+
'id' => $post->ID,
|
118 |
+
'itemtag' => $itemtag,
|
119 |
+
'icontag' => $icontag,
|
120 |
+
'captiontag' => $captiontag,
|
121 |
+
'caption' => $caption,
|
122 |
+
'size' => $size,
|
123 |
+
'link_posts' => $link_posts,
|
124 |
+
) );
|
125 |
|
126 |
echo '<br style="clear: both;" />';
|
127 |
echo "</div></div>\n";
|