Move mode setting to event options
This commit is contained in:
@@ -166,9 +166,6 @@ class SP_Admin_Welcome {
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
if ( isset( $_POST['sportspress_load_individual_mode_module'] ) ):
|
|
||||||
update_option( 'sportspress_load_individual_mode_module', $_POST['sportspress_load_individual_mode_module'] );
|
|
||||||
endif;
|
|
||||||
if ( isset( $_POST['add_sample_data'] ) ):
|
if ( isset( $_POST['add_sample_data'] ) ):
|
||||||
SP_Admin_Sample_Data::delete_posts();
|
SP_Admin_Sample_Data::delete_posts();
|
||||||
SP_Admin_Sample_Data::insert_posts();
|
SP_Admin_Sample_Data::insert_posts();
|
||||||
@@ -193,10 +190,6 @@ class SP_Admin_Welcome {
|
|||||||
?>
|
?>
|
||||||
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ) ); ?>"><i class="dashicons dashicons-edit"></i> <?php _e( 'Change', 'sportspress' ); ?></a>
|
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ) ); ?>"><i class="dashicons dashicons-edit"></i> <?php _e( 'Change', 'sportspress' ); ?></a>
|
||||||
|
|
||||||
<h4><?php _e( 'Mode', 'sportspress' ); ?></h4>
|
|
||||||
<?php echo ( 'yes' == get_option( 'sportspress_load_individual_mode_module', 'no' ) ? __( 'Player vs player', 'sportspress' ) : __( 'Team vs team', 'sportspress' ) ); ?>
|
|
||||||
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ) ); ?>"><i class="dashicons dashicons-edit"></i> <?php _e( 'Change', 'sportspress' ); ?></a>
|
|
||||||
|
|
||||||
<h4><?php _e( 'Next Steps', 'sportspress' ); ?></h4>
|
<h4><?php _e( 'Next Steps', 'sportspress' ); ?></h4>
|
||||||
<p><?php _e( 'We’ve assembled some links to get you started:', 'sportspress' ); ?></p>
|
<p><?php _e( 'We’ve assembled some links to get you started:', 'sportspress' ); ?></p>
|
||||||
<?php
|
<?php
|
||||||
@@ -278,18 +271,6 @@ class SP_Admin_Welcome {
|
|||||||
'class' => $class,
|
'class' => $class,
|
||||||
'options' => $sport_options,
|
'options' => $sport_options,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
|
||||||
'title' => __( 'Mode', 'sportspress' ),
|
|
||||||
'id' => 'sportspress_load_individual_mode_module',
|
|
||||||
'default' => 'no',
|
|
||||||
'type' => 'radio',
|
|
||||||
'options' => array(
|
|
||||||
'no' => __( 'Team vs team', 'sportspress' ),
|
|
||||||
'yes' => __( 'Player vs player', 'sportspress' ),
|
|
||||||
),
|
|
||||||
'desc_tip' => _x( 'Who competes in events?', 'mode setting description', 'sportspress' ),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
SP_Admin_Settings::output_fields( $settings );
|
SP_Admin_Settings::output_fields( $settings );
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
|
|
||||||
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
||||||
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
||||||
|
add_action( 'sportspress_admin_field_current_mode', array( $this, 'current_mode_setting' ) );
|
||||||
add_action( 'sportspress_admin_field_delimiter', array( $this, 'delimiter_setting' ) );
|
add_action( 'sportspress_admin_field_delimiter', array( $this, 'delimiter_setting' ) );
|
||||||
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
||||||
}
|
}
|
||||||
@@ -86,13 +87,27 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'desc' => __( 'Player Performance', 'sportspress' ),
|
'desc' => __( 'Box Score', 'sportspress' ),
|
||||||
'id' => 'sportspress_event_show_performance',
|
'id' => 'sportspress_event_show_performance',
|
||||||
'default' => 'yes',
|
'default' => 'yes',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'checkboxgroup' => 'end',
|
'checkboxgroup' => 'end',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'title' => __( 'Mode', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_load_individual_mode_module',
|
||||||
|
'default' => 'no',
|
||||||
|
'type' => 'radio',
|
||||||
|
'options' => array(
|
||||||
|
'no' => __( 'Team vs team', 'sportspress' ),
|
||||||
|
'yes' => __( 'Player vs player', 'sportspress' ),
|
||||||
|
),
|
||||||
|
'desc_tip' => _x( 'Who competes in events?', 'mode setting description', 'sportspress' ),
|
||||||
|
),
|
||||||
|
|
||||||
|
array( 'type' => 'current_mode' ),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Limit', 'sportspress' ),
|
'title' => __( 'Limit', 'sportspress' ),
|
||||||
'id' => 'sportspress_event_teams',
|
'id' => 'sportspress_event_teams',
|
||||||
@@ -108,6 +123,23 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
|
|
||||||
array( 'type' => 'delimiter' ),
|
array( 'type' => 'delimiter' ),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'title' => __( 'Teams', 'sportspress' ),
|
||||||
|
'desc' => __( 'Filter by competition', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_event_filter_teams_by_league',
|
||||||
|
'default' => 'no',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'checkboxgroup' => 'start',
|
||||||
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'desc' => __( 'Filter by season', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_event_filter_teams_by_season',
|
||||||
|
'default' => 'no',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'checkboxgroup' => 'end',
|
||||||
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Venues', 'sportspress' ),
|
'title' => __( 'Venues', 'sportspress' ),
|
||||||
'desc' => __( 'Display maps', 'sportspress' ),
|
'desc' => __( 'Display maps', 'sportspress' ),
|
||||||
@@ -202,7 +234,7 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
array( 'title' => __( 'Player Performance', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'performance_options' ),
|
array( 'title' => __( 'Box Score', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'performance_options' ),
|
||||||
),
|
),
|
||||||
|
|
||||||
apply_filters( 'sportspress_performance_options', array(
|
apply_filters( 'sportspress_performance_options', array(
|
||||||
@@ -364,6 +396,21 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output script to refresh page when mode is changed.
|
||||||
|
*/
|
||||||
|
function current_mode_setting() {
|
||||||
|
?>
|
||||||
|
<input type="hidden" name="sportspress_individual_mode_module_loaded" value="<?php echo get_option( 'sportspress_load_individual_mode_module', 'no' ); ?>">
|
||||||
|
<?php if ( sp_array_value( $_POST, 'sportspress_load_individual_mode_module', 'no' ) !== sp_array_value( $_POST, 'sportspress_individual_mode_module_loaded', 'no' ) ) { ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.onload = function() {
|
||||||
|
window.location = window.location.href;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ class SP_Settings_General extends SP_Settings_Page {
|
|||||||
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
||||||
add_action( 'sportspress_admin_field_timezone', array( $this, 'timezone_setting' ) );
|
add_action( 'sportspress_admin_field_timezone', array( $this, 'timezone_setting' ) );
|
||||||
add_action( 'sportspress_admin_field_frontend_styles', array( $this, 'frontend_styles_setting' ) );
|
add_action( 'sportspress_admin_field_frontend_styles', array( $this, 'frontend_styles_setting' ) );
|
||||||
add_action( 'sportspress_admin_field_current_mode', array( $this, 'current_mode_setting' ) );
|
|
||||||
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,20 +56,6 @@ class SP_Settings_General extends SP_Settings_Page {
|
|||||||
'type' => 'sport',
|
'type' => 'sport',
|
||||||
'options' => $presets,
|
'options' => $presets,
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
|
||||||
'title' => __( 'Mode', 'sportspress' ),
|
|
||||||
'id' => 'sportspress_load_individual_mode_module',
|
|
||||||
'default' => 'no',
|
|
||||||
'type' => 'radio',
|
|
||||||
'options' => array(
|
|
||||||
'no' => __( 'Team vs team', 'sportspress' ),
|
|
||||||
'yes' => __( 'Player vs player', 'sportspress' ),
|
|
||||||
),
|
|
||||||
'desc_tip' => _x( 'Who competes in events?', 'mode setting description', 'sportspress' ),
|
|
||||||
),
|
|
||||||
|
|
||||||
array( 'type' => 'current_mode' ),
|
|
||||||
)),
|
)),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
@@ -363,21 +348,6 @@ class SP_Settings_General extends SP_Settings_Page {
|
|||||||
<input name="' . esc_attr( $id ). '" id="' . esc_attr( $id ) . '" type="text" value="' . esc_attr( $value ) . '" class="colorpick" /> <div id="colorPickerDiv_' . esc_attr( $id ) . '" class="colorpickdiv"></div>
|
<input name="' . esc_attr( $id ). '" id="' . esc_attr( $id ) . '" type="text" value="' . esc_attr( $value ) . '" class="colorpick" /> <div id="colorPickerDiv_' . esc_attr( $id ) . '" class="colorpickdiv"></div>
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Output script to refresh page when mode is changed.
|
|
||||||
*/
|
|
||||||
function current_mode_setting() {
|
|
||||||
?>
|
|
||||||
<input type="hidden" name="sportspress_individual_mode_module_loaded" value="<?php echo get_option( 'sportspress_load_individual_mode_module', 'no' ); ?>">
|
|
||||||
<?php if ( sp_array_value( $_POST, 'sportspress_load_individual_mode_module', 'no' ) !== sp_array_value( $_POST, 'sportspress_individual_mode_module_loaded', 'no' ) ) { ?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
window.onload = function() {
|
|
||||||
window.location = window.location.href;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
Reference in New Issue
Block a user