From 71d218763bc20fe391ae50104bb457c8d3d0f74e Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Fri, 18 Sep 2015 11:14:06 +1000 Subject: [PATCH] Remove status and adjust menu highlighting in individual mode --- modules/sportspress-individual-mode.php | 50 ++++++++++++------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/modules/sportspress-individual-mode.php b/modules/sportspress-individual-mode.php index 6c644375..c1a58ffe 100644 --- a/modules/sportspress-individual-mode.php +++ b/modules/sportspress-individual-mode.php @@ -44,8 +44,6 @@ class SportsPress_Individual_Mode { add_filter( 'sportspress_next_steps', array( $this, 'remove_team_step' ), 99 ); add_filter( 'sportspress_modules', array( $this, 'rearrange_modules' ), 99 ); add_filter( 'sportspress_glance_items', array( $this, 'remove_glance_item' ), 99 ); - add_filter( 'sportspress_shortcodes', array( $this, 'remove_shortcodes' ), 99 ); - add_filter( 'sportspress_event_shortcodes', array( $this, 'remove_event_shortcodes' ), 99 ); add_filter( 'sportspress_player_admin_columns', array( $this, 'remove_team_column' ), 99 ); add_filter( 'sportspress_list_admin_columns', array( $this, 'remove_team_column' ), 99 ); add_filter( 'sportspress_staff_admin_columns', array( $this, 'remove_team_column' ), 99 ); @@ -57,11 +55,10 @@ class SportsPress_Individual_Mode { add_filter( 'sportspress_player_teams', '__return_false' ); add_filter( 'sportspress_staff_teams', '__return_false' ); add_filter( 'sportspress_list_team_selector', '__return_false' ); - add_filter( 'option_sportspress_event_split_players_by_team', '__return_false' ); + add_filter( 'pre_option_sportspress_event_split_players_by_team', array( $this, 'no' ) ); + add_filter( 'pre_option_sportspress_event_show_status', array( $this, 'no' ) ); add_filter( 'sportspress_has_teams', '__return_false' ); - - // Remove templates - //remove_action( 'sportspress_single_event_content', 'sportspress_output_event_performance', 50 ); + add_action( 'admin_head', array( $this, 'menu_highlight' ) ); } /** @@ -78,6 +75,13 @@ class SportsPress_Individual_Mode { define( 'SP_INDIVIDUAL_MODE_DIR', plugin_dir_path( __FILE__ ) ); } + /** + * Return no. + */ + public function no() { + return 'no'; + } + public function save_player_meta( $post_id, $post ) { if ( isset( $_POST['sp_team'] ) && is_array( $_POST['sp_team'] ) ) { $players = array(); @@ -230,26 +234,6 @@ class SportsPress_Individual_Mode { return $items; } - /** - * Remove shortcodes from editor. - */ - public function remove_shortcodes( $shortcodes ) { - if ( array_key_exists( 'event', $shortcodes ) ) { - if ( ( $index = array_search ( 'performance', $shortcodes['event'] ) ) !== false ) { - unset( $shortcodes['event'][ $index ] ); - } - } - return $shortcodes; - } - - /** - * Remove shortcodes from event meta box. - */ - public function remove_event_shortcodes( $shortcodes ) { - unset( $shortcodes['event_performance'] ); - return $shortcodes; - } - /** * Remove team column from player list admin. */ @@ -275,6 +259,20 @@ class SportsPress_Individual_Mode { } return $slugs; } + + /** + * Highlights the correct top level admin menu item for post type add screens. + * + * @access public + * @return void + */ + public function menu_highlight() { + global $typenow, $parent_file, $submenu_file; + if ( 'sp_table' == $typenow ) { + $parent_file = 'edit.php?post_type=sp_player'; + $submenu_file = 'edit.php?post_type=sp_table'; + } + } } endif;