diff --git a/actions.php b/actions.php index d9705156..9417bc2f 100644 --- a/actions.php +++ b/actions.php @@ -10,13 +10,18 @@ function sp_after_theme_setup() { } add_action( 'after_theme_setup', 'sp_after_theme_setup' ); -function sp_save_post() { - global $post, $post_id, $typenow; +function sp_nonce() { + echo ''; +} + +function sp_save_post( $post_id ) { + global $post, $typenow; if ( isset( $_POST['sportspress'] ) ): $sportspress = (array)$_POST['sportspress']; if ( isset( $_POST ) && !empty( $sportspress ) ): if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id; - // if ( ! isset( $_POST['sp_event_team_nonce'] ) || ! wp_verify_nonce( $_POST['sp_event_team_nonce'], plugin_basename( __FILE__ ) ) ) return $post_id; + if ( !current_user_can( 'edit_post', $post_id ) ) return $post_id; + if ( !isset( $_POST['sportspress_nonce'] ) || ! wp_verify_nonce( $_POST['sportspress_nonce'], plugin_basename( __FILE__ ) ) ) return $post_id; foreach ( $sportspress as $key => $value ): if ( is_array( $value ) ) $value = serialize( $value ); diff --git a/event.php b/event.php index 9cb19902..6ebfdbe5 100644 --- a/event.php +++ b/event.php @@ -180,7 +180,7 @@ function sp_event_team_meta( $post, $metabox ) { '; + sp_nonce(); } function sp_event_article_meta( $post, $metabox ) { diff --git a/helpers.php b/helpers.php index 9dbbaaa4..b95f66b0 100644 --- a/helpers.php +++ b/helpers.php @@ -94,4 +94,54 @@ if ( ! function_exists( 'sp_get_teams' ) ) { return $teams; } } + +if ( ! function_exists( 'sp_team_checklist' ) ) { + function sp_team_checklist( $post_id = null ) { + if ( ! isset( $post_id ) ) + global $post_id; + $selected = sp_get_teams( $post_id ); + $teams = get_pages( array( 'post_type' => 'sp_team') ); + foreach ( $teams as $team ): + ?> +
  • + +
  • + + +
    + + +
    +
    +

    + + + + +

    +
    + \ No newline at end of file diff --git a/images/menu.png b/images/menu.png index 0e8ada09..9bbc4a14 100644 Binary files a/images/menu.png and b/images/menu.png differ diff --git a/player.php b/player.php index aaaf1d57..3a5f2cb7 100644 --- a/player.php +++ b/player.php @@ -22,45 +22,8 @@ function sp_player_meta_init() { } function sp_player_basic_meta( $post, $metabox ) { global $post_id; - ?> - -
    - - -
    -
    -

    - - + - -

    -
    - '; + sp_team_select_html( $post_id ); + sp_nonce(); } function sp_player_profile_meta( $post, $metabox ) { diff --git a/sportspress-admin.css b/sportspress-admin.css index f920e4f2..080e4d5d 100644 --- a/sportspress-admin.css +++ b/sportspress-admin.css @@ -1,4 +1,3 @@ -#adminmenu #toplevel_page_sp_settings div.wp-menu-image, #adminmenu #menu-posts-sp_team div.wp-menu-image, #adminmenu #menu-posts-sp_event div.wp-menu-image, #adminmenu #menu-posts-sp_player div.wp-menu-image, @@ -10,15 +9,9 @@ #adminmenu #menu-posts-sp_venue div.wp-menu-image { background-image: url(images/menu.png); background-repeat: no-repeat; -} -#adminmenu #toplevel_page_sp_settings div.wp-menu-image { background-position: 1px -33px; } -#adminmenu #toplevel_page_sp_settings:hover div.wp-menu-image, -#adminmenu #toplevel_page_sp_settings.wp-has-current-submenu div.wp-menu-image, -#adminmenu #toplevel_page_sp_settings.current div.wp-menu-image { - background-position: 1px -1px; -} +/* #adminmenu #menu-posts-sp_team div.wp-menu-image { background-position: 1px -97px; } @@ -27,6 +20,15 @@ #adminmenu #menu-posts-sp_team.current div.wp-menu-image { background-position: 1px -65px; } +*/ +#adminmenu #menu-posts-sp_team div.wp-menu-image { + background-position: 1px -33px; +} +#adminmenu #menu-posts-sp_team:hover div.wp-menu-image, +#adminmenu #menu-posts-sp_team.wp-has-current-submenu div.wp-menu-image, +#adminmenu #menu-posts-sp_team.current div.wp-menu-image { + background-position: 1px -1px; +} #adminmenu #menu-posts-sp_event div.wp-menu-image { background-position: -29px -33px; }