Require box score importer to be accessed from within an event
This commit is contained in:
@@ -28,6 +28,7 @@ class SP_Admin_Importers {
|
||||
* Add menu items
|
||||
*/
|
||||
public function register_importers() {
|
||||
global $pagenow;
|
||||
$importers = apply_filters( 'sportspress_importers', array(
|
||||
'sp_event_csv' => array(
|
||||
'name' => __( 'SportsPress Events (CSV)', 'sportspress' ),
|
||||
@@ -39,11 +40,6 @@ class SP_Admin_Importers {
|
||||
'description' => __( 'Import <strong>upcoming events</strong> from a csv file.', 'sportspress'),
|
||||
'callback' => array( $this, 'fixtures_importer' ),
|
||||
),
|
||||
'sp_event_performance_csv' => array(
|
||||
'name' => __( 'SportsPress Box Score (CSV)', 'sportspress' ),
|
||||
'description' => __( 'Import <strong>event box scores</strong> from a csv file.', 'sportspress'),
|
||||
'callback' => array( $this, 'event_performance_importer' ),
|
||||
),
|
||||
'sp_team_csv' => array(
|
||||
'name' => __( 'SportsPress Teams (CSV)', 'sportspress' ),
|
||||
'description' => __( 'Import <strong>teams</strong> from a csv file.', 'sportspress'),
|
||||
@@ -61,6 +57,14 @@ class SP_Admin_Importers {
|
||||
),
|
||||
) );
|
||||
|
||||
if ( 'import.php' !== $pagenow ) {
|
||||
$importers['sp_event_performance_csv'] = array(
|
||||
'name' => __( 'SportsPress Box Score (CSV)', 'sportspress' ),
|
||||
'description' => '<a href="' . admin_url( add_query_arg( array( 'post_type' => 'sp_event' ), 'edit.php' ) ) . '">' . sprintf( __( 'Select %s', 'sportspress' ), __( 'Event', 'sportspress' ) ) . '</a>',
|
||||
'callback' => array( $this, 'event_performance_importer' ),
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( $importers as $id => $importer ) {
|
||||
register_importer( $id, $importer['name'], $importer['description'], $importer['callback'] );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user