Fix event team limit issue, update to 0.8.6

This commit is contained in:
Brian Miyaji
2014-05-08 13:52:25 +10:00
parent dc88aff65d
commit ba579cfb9e
4 changed files with 28 additions and 23 deletions

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy * @author ThemeBoy
* @category Admin * @category Admin
* @package SportsPress/Admin/Meta Boxes * @package SportsPress/Admin/Meta Boxes
* @version 0.8.4 * @version 0.8.6
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -19,39 +19,41 @@ class SP_Meta_Box_Event_Teams {
* Output the metabox * Output the metabox
*/ */
public static function output( $post ) { public static function output( $post ) {
$teams = (array)get_post_meta( $post->ID, 'sp_team', false ); $limit = get_option( 'sportspress_event_teams', 2 );
foreach ( $teams as $key => $value ): $teams = (array) get_post_meta( $post->ID, 'sp_team', false );
?> for ( $i = 0; $i < $limit; $i ++ ):
$team = array_shift( $teams );
?>
<div class="sp-instance"> <div class="sp-instance">
<p class="sp-tab-select sp-title-generator"> <p class="sp-tab-select sp-title-generator">
<?php <?php
$args = array( $args = array(
'post_type' => 'sp_team', 'post_type' => 'sp_team',
'name' => 'sp_team[]', 'name' => 'sp_team[]',
'class' => 'sportspress-pages', 'class' => 'sportspress-pages',
'show_option_none' => sprintf( __( '&mdash; None &mdash;', 'sportspress' ), 'Team' ), 'show_option_none' => sprintf( __( '&mdash; None &mdash;', 'sportspress' ), 'Team' ),
'selected' => $value 'selected' => $team
); );
wp_dropdown_pages( $args ); wp_dropdown_pages( $args );
?> ?>
</p> </p>
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar"> <ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
<li class="wp-tab-active"><a href="#sp_player-all"><?php _e( 'Players', 'sportspress' ); ?></a></li> <li class="wp-tab-active"><a href="#sp_player-all"><?php _e( 'Players', 'sportspress' ); ?></a></li>
<li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li> <li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
</ul> </ul>
<?php <?php
sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_current_team', $key ); sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_current_team', $i );
sp_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $key ); sp_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $i );
?> ?>
</div> </div>
<?php endforeach; <?php
endfor;
} }
/** /**
* Save meta box data * Save meta box data
*/ */
public static function save( $post_id, $post ) { public static function save( $post_id, $post ) {
sp_update_post_meta( $post_id, 'sp_limit', sp_array_value( $_POST, 'sp_limit', 2 ) );
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) ); sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
sp_update_post_meta_recursive( $post_id, 'sp_staff', sp_array_value( $_POST, 'sp_staff', array() ) ); sp_update_post_meta_recursive( $post_id, 'sp_staff', sp_array_value( $_POST, 'sp_staff', array() ) );

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy * @author ThemeBoy
* @category Admin * @category Admin
* @package SportsPress/Admin * @package SportsPress/Admin
* @version 0.8 * @version 0.8.6
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

View File

@@ -1,6 +1,6 @@
=== SportsPress - sports league management === === SportsPress - sports league management ===
Contributors: ThemeBoy Contributors: ThemeBoy
Tags: sports, press, soccer, football, teams, fixtures, results, standings, league tables, leagues, world cup, statistics, stats, themeboy Tags: sport, sports, press, club, sport statistics, sports management, soccer, football, teams, fixtures, results, standings, league tables, leagues, world cup, statistics, stats, wordpress sports, themeboy
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.9 Tested up to: 3.9
@@ -120,6 +120,9 @@ Yes, CSV importers are included with the plugin. Go to Tools > Import and choose
== Changelog == == Changelog ==
= 0.8.6 =
* Fix - Issue adding teams to events.
= 0.8.5 = = 0.8.5 =
* Fix - Issue saving new venues. * Fix - Issue saving new venues.

View File

@@ -3,7 +3,7 @@
* Plugin Name: SportsPress * Plugin Name: SportsPress
* Plugin URI: http://wordpress.org/plugins/sportspress * Plugin URI: http://wordpress.org/plugins/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.8.5 * Version: 0.8.6
* Author: ThemeBoy * Author: ThemeBoy
* Author URI: http://themeboy.com * Author URI: http://themeboy.com
* Requires at least: 3.8 * Requires at least: 3.8
@@ -26,14 +26,14 @@ if ( ! class_exists( 'SportsPress' ) ) :
* Main SportsPress Class * Main SportsPress Class
* *
* @class SportsPress * @class SportsPress
* @version 0.8.5 * @version 0.8.6
*/ */
final class SportsPress { final class SportsPress {
/** /**
* @var string * @var string
*/ */
public $version = '0.8.5'; public $version = '0.8.6';
/** /**
* @var SporsPress The single instance of the class * @var SporsPress The single instance of the class