Skip to content

Commit

Permalink
Merge pull request #29 from ClubPress/dev
Browse files Browse the repository at this point in the history
Merge 2.2.3
  • Loading branch information
Leon Terry authored Oct 22, 2020
2 parents 2f8ea53 + 66dcd60 commit cdd4fe2
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 115 deletions.
4 changes: 2 additions & 2 deletions dummy-data/staff-sample.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
First Name,Last Name,Jobs,Team,Season,Date of Birth,Nationality,Email,Phone
John,Smith,Physiotherapist,Reserves,2013-14,1973-10-14,US,name@example.com,0123456789
First Name,Last Name,Jobs,Date of Birth,Nationality,Email,Phone
John,Smith,Physiotherapist,1973-10-14,US,name@example.com,0123456789
151 changes: 49 additions & 102 deletions includes/admin/class-wpcm-admin-setup-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ public function setup_wizard_content() {
public function wpcm_setup_introduction() {
?>
<h2><?php _e( 'Welcome to WP Club Manager', 'wp-club-manager' ); ?></h2>
<h4><?php _e( 'Thank you for choosing WP Club Manager to power your club or league website!', 'wp-club-manager' ); ?></h4>
<p><?php _e( 'This quick setup wizard will help you configure the basic settings to get your club or league website up and running as quickly as possible. It’s completely optional and should only take a couple of minutes at most.', 'wp-club-manager' ); ?></p>
<h4><?php _e( 'Thank you for choosing WP Club Manager to power your club website!', 'wp-club-manager' ); ?></h4>
<p><?php _e( 'This quick setup wizard will help you configure the basic settings to get your club website up and running as quickly as possible. It’s completely optional and should only take a couple of minutes at most.', 'wp-club-manager' ); ?></p>
<p><?php _e( 'No time right now? If you don’t want to go through the wizard now, you can skip and return to the WordPress dashboard. Come back anytime if you change your mind!', 'wp-club-manager' ); ?></p>

<div class="ui hidden section divider"></div>
Expand Down Expand Up @@ -214,24 +214,6 @@ public function wpcm_setup_general() {

<form class="ui form" method="post">

<div class="inline field">
<label for="plugin_mode"><?php _e( 'Choose your plugin mode:', 'wp-club-manager' ); ?></label>
<div class="plugin_mode">
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="plugin_mode" value="club"<?php echo ( $mode == 'club' ? ' checked=""' : '' ); ?>>
<label><?php _e( 'Club mode', 'wp-club-manager' ); ?></label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="plugin_mode" value="league"<?php echo ( $mode == 'league' ? ' checked=""' : '' ); ?>>
<label><?php _e( 'League mode', 'wp-club-manager' ); ?></label>
</div>
</div>
</div>
</div>

<div class="inline field">
<label for="club_location"><?php _e( 'Choose your default country:', 'wp-club-manager' ); ?></label>
<select id="club_location" name="club_location" class="ui search dropdown">
Expand Down Expand Up @@ -266,10 +248,10 @@ public function wpcm_setup_general() {
public function wpcm_setup_general_save() {
check_admin_referer( 'wpcm-setup' );

if( isset( $_POST['plugin_mode'] ) ){
$plugin_mode = $_POST['plugin_mode'];
update_option( 'wpcm_mode', $plugin_mode );
}
// if( isset( $_POST['plugin_mode'] ) ){
// $plugin_mode = $_POST['plugin_mode'];
// update_option( 'wpcm_mode', $plugin_mode );
// }
if( isset( $_POST['club_location'] ) ){
$club_location = sanitize_text_field( $_POST['club_location'] );
update_option( 'wpcm_default_country', $club_location );
Expand Down Expand Up @@ -312,14 +294,10 @@ public function wpcm_setup_club() {

<form class="ui form" method="post">

<?php
if( is_club_mode() ) { ?>
<div class="inline field">
<label for="default_club"><?php _e( 'Enter your club name:', 'wp-club-manager' ); ?></label>
<input type="text" id="default_club" name="default_club" placeholder="<?php esc_attr_e( 'eg. West Ham United', 'wp-club-manager' ); ?>" />
</div>
<?php
} ?>
<div class="inline field">
<label for="default_club"><?php _e( 'Enter your club name:', 'wp-club-manager' ); ?></label>
<input type="text" id="default_club" name="default_club" placeholder="<?php esc_attr_e( 'eg. West Ham United', 'wp-club-manager' ); ?>" />
</div>

<div class="inline field">
<label for="setup_comp"><?php _e( 'Enter a competition:', 'wp-club-manager' ); ?></label>
Expand All @@ -332,14 +310,7 @@ public function wpcm_setup_club() {
</div>

<div class="inline field">
<?php
if( is_club_mode() ) { ?>
<label for="setup_opponent"><?php _e( 'Add your next opponent:', 'wp-club-manager' ); ?></label>
<?php
}elseif( is_league_mode() ) { ?>
<label for="setup_opponent"><?php _e( 'Add a club:', 'wp-club-manager' ); ?></label>
<?php
} ?>
<label for="setup_opponent"><?php _e( 'Add your next opponent:', 'wp-club-manager' ); ?></label>
<input type="text" id="setup_opponent" name="setup_opponent" placeholder="<?php esc_attr_e( 'eg. Manchester United', 'wp-club-manager' ); ?>" />
</div>

Expand Down Expand Up @@ -373,72 +344,34 @@ public function wpcm_setup_club_save() {
update_term_meta( $comp_id, 'tax_position', 1 );
}

if( is_club_mode() ) {
if( isset( $_POST['default_club'] ) && ! empty( $_POST['default_club'] ) && get_option( 'wpcm_default_club', null ) != $_POST['default_club'] ){
$title = sanitize_text_field( $_POST['default_club'] );
$post = array(
'post_title' => $title,
if( isset( $_POST['default_club'] ) && ! empty( $_POST['default_club'] ) && get_option( 'wpcm_default_club', null ) != $_POST['default_club'] ){
$title = sanitize_text_field( $_POST['default_club'] );
$post = array(
'post_title' => $title,
'post_type' => 'wpcm_club',
'post_status' => 'publish'
);
$wpcm_default_club = wp_insert_post( $post );
update_option( 'wpcm_default_club', $wpcm_default_club );

//wpcm_flush_rewrite_rules();

$team = __( 'First Team', 'wp-club-manager' );
$team_id = wp_insert_term( $team, 'wpcm_team' );
update_term_meta( $team_id, 'tax_position', 1 );

if( isset( $_POST['setup_opponent'] ) ){
$opponent = sanitize_text_field( $_POST['setup_opponent'] );
$args = array(
'post_title' => $opponent,
'post_type' => 'wpcm_club',
'post_status' => 'publish'
);
$wpcm_default_club = wp_insert_post( $post );
update_option( 'wpcm_default_club', $wpcm_default_club );

//wpcm_flush_rewrite_rules();

$team = __( 'First Team', 'wp-club-manager' );
$team_id = wp_insert_term( $team, 'wpcm_team' );
update_term_meta( $team_id, 'tax_position', 1 );

if( isset( $_POST['setup_opponent'] ) ){
$opponent = sanitize_text_field( $_POST['setup_opponent'] );
$args = array(
'post_title' => $opponent,
'post_type' => 'wpcm_club',
'post_status' => 'publish'
);
$opponent_id = wp_insert_post( $args );
}

if( isset( $_POST['setup_season'] ) && isset( $_POST['setup_comp'] ) ) {

if( empty( $_POST['setup_opponent'] ) ){
$opponent_id = null;
}

$title = $comp . ' -- ' . $season;
$league_table = array(
'post_title' => $title,
'post_type' => 'wpcm_table',
'post_status' => 'publish',
'tax_input' => array(
'wpcm_season' => $season_id,
'wpcm_comp' => $comp_id,
'wpcm_team' => $team_id
)
);
$table_id = wp_insert_post( $league_table );
$clubs = array( $wpcm_default_club, $opponent_id );
update_post_meta( $table_id, '_wpcm_table_clubs', serialize( $clubs ) );


$title = $team . ' -- ' . $season;
$roster = array(
'post_title' => $title,
'post_type' => 'wpcm_roster',
'post_status' => 'publish',
'tax_input' => array(
'wpcm_season' => $season_id,
'wpcm_team' => $team_id
)
);
wp_insert_post( $roster );
}
$opponent_id = wp_insert_post( $args );
}
}elseif( is_league_mode() ) {

if( isset( $_POST['setup_season'] ) && isset( $_POST['setup_comp'] ) ) {

if( empty( $_POST['setup_opponent'] ) ){
$opponent_id = null;
}
Expand All @@ -450,12 +383,26 @@ public function wpcm_setup_club_save() {
'post_status' => 'publish',
'tax_input' => array(
'wpcm_season' => $season_id,
'wpcm_comp' => $comp_id
'wpcm_comp' => $comp_id,
'wpcm_team' => $team_id
)
);
$table_id = wp_insert_post( $league_table );
$clubs = array( $opponent_id );
$clubs = array( $wpcm_default_club, $opponent_id );
update_post_meta( $table_id, '_wpcm_table_clubs', serialize( $clubs ) );


$title = $team . ' -- ' . $season;
$roster = array(
'post_title' => $title,
'post_type' => 'wpcm_roster',
'post_status' => 'publish',
'tax_input' => array(
'wpcm_season' => $season_id,
'wpcm_team' => $team_id
)
);
wp_insert_post( $roster );
}
}

Expand Down
4 changes: 2 additions & 2 deletions includes/admin/importers/class-wpcm-staff-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @author ClubPress
* @category Admin
* @package WPClubManager/Admin/Importers
* @version 2.0.2
* @version 2.2.3
*/

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
Expand Down Expand Up @@ -133,7 +133,7 @@ public function header() {
public function greet() {
echo '<div class="narrow">';
echo '<p>' . __( 'Choose a .csv file to upload, then click "Upload file and import".', 'wp-club-manager' ).'</p>';
echo '<p>' . sprintf( __( 'Staff need to be defined with columns in a specific order (6 columns). <a href="%s">Click here to download a sample</a>.', 'wp-club-manager' ), plugin_dir_url( WPCM_PLUGIN_FILE ) . 'dummy-data/staff-sample.csv' ) . '</p>';
echo '<p>' . sprintf( __( 'Staff need to be defined with columns in a specific order (7 columns). <a href="%s">Click here to download a sample</a>.', 'wp-club-manager' ), plugin_dir_url( WPCM_PLUGIN_FILE ) . 'dummy-data/staff-sample.csv' ) . '</p>';
wp_import_upload_form( 'admin.php?import=wpclubmanager_staff_csv&step=1' );
echo '</div>';
}
Expand Down
10 changes: 5 additions & 5 deletions includes/shortcodes/class-wpcm-shortcode-match-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @author Clubpress
* @category Shortcodes
* @package WPClubManager/Shortcodes
* @version 2.1.0
* @version 2.2.3
*/

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
Expand Down Expand Up @@ -78,11 +78,11 @@ public static function output( $atts ) {
if( $output === false ) {

if( $format == '' ){
$format = array('publish','future');
$post_status = array('publish','future');
}elseif( $format == 'fixtures' ){
$format = 'future';
$post_status = 'future';
}elseif( $format == 'results' ){
$format = 'publish';
$post_status = 'publish';
}

// get matches
Expand All @@ -91,7 +91,7 @@ public static function output( $atts ) {
'order' => $order,
'orderby' => 'post_date',
'post_type' => 'wpcm_match',
'post_status' => $format,
'post_status' => $post_status,
'posts_per_page' => $limit
);

Expand Down
9 changes: 7 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Requires at least: 4.9
Tested up to: 5.5
Requires PHP: 5.6
Stable tag: 2.2.2
Stable tag: 2.2.3
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -133,7 +133,7 @@ Automatic updates should work as expected but as always, it is recommended that

= Is this plugin suitable for managing a league website? =

Yes! Since version 2 WP Club Manager is built to manage either a single club or league website.
Yes! Since version 2 WP Club Manager is built to manage either a single club or league website. Please note that league mode does have some limitations and will not record player statistics for matches.

= My sport is not supported. How can I add my sport? =

Expand Down Expand Up @@ -167,6 +167,11 @@ You can help improve this plugin by reporting any bugs or contributing to the so

== Changelog ==

= 2.2.3 22/10/2020

* Fix - Fixed staff importer
* Fix - Fixed unplayed matches showing in Match List shortcode in results format

= 2.2.2 09/10/2020

* Fix - Fixed warning message when sorting players in matches
Expand Down
4 changes: 2 additions & 2 deletions wpclubmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: A plugin to help you run a sports club website easily and quickly.
* Author: Clubpress
* Author URI: https://wpclubmanager.com
* Version: 2.2.2
* Version: 2.2.3
* Text Domain: wp-club-manager
* Domain Path: /languages/
* License: GPLv3
Expand All @@ -30,7 +30,7 @@ final class WPClubManager {
/**
* @var string
*/
public $version = '2.2.2';
public $version = '2.2.3';

/**
* @var WPClubManager The single instance of the class
Expand Down

0 comments on commit cdd4fe2

Please sign in to comment.