Add nonce and team select functions

This commit is contained in:
Takumi
2013-07-25 14:52:58 +10:00
parent 39d0c1aac6
commit 3f82e5c72c
6 changed files with 71 additions and 51 deletions

View File

@@ -22,45 +22,8 @@ function sp_player_meta_init() {
}
function sp_player_basic_meta( $post, $metabox ) {
global $post_id;
?>
<ul id="sp_team-tabs" class="wp-tab-bar">
<li class="tabs wp-tab-active"><?php _e( 'Teams', 'sportspress' ); ?></li>
</ul>
<div id="sp_team-all" class="wp-tab-panel">
<input type="hidden" value="0" name="sportspress[sp_teams]" />
<ul class="categorychecklist form-no-clear">
<?php
$player_teams = sp_get_teams( $post_id );
$teams = get_pages( array( 'post_type' => 'sp_team') );
foreach ( $teams as $team ):
?>
<li>
<label class="selectit">
<input type="checkbox" value="<?php echo $team->ID; ?>" name="sportspress[sp_teams][]"<?php if ( in_array( $team->ID, $player_teams ) ) echo ' checked="checked"'; ?>>
<?php
if ( $team->post_parent ):
$parents = get_post_ancestors( $team );
echo str_repeat( '— ', sizeof( $parents ) );
endif;
echo $team->post_title;
?>
</label>
</li>
<?php
endforeach;
?>
</ul>
</div>
<div id="sp_league-adder" class="wp-hidden-children">
<h4><?php add_thickbox(); ?>
<a title="<?php echo sprintf( esc_attr__( 'Add New %s', 'sportspress' ), esc_attr__( 'Team', 'sportspress' ) ); ?>" href="<?php echo admin_url( 'post-new.php?post_type=sp_team' ); ?>" target="_blank">
+ <?php echo sprintf( __( 'Add New %s', 'sportspress' ), __( 'Team', 'sportspress' ) ); ?>
</a>
</h4>
</div>
<?php
wp_reset_postdata();
echo '<input type="hidden" name="sp_event_team_nonce" id="sp_event_team_nonce" value="' . wp_create_nonce( plugin_basename( __FILE__ ) ) . '" />';
sp_team_select_html( $post_id );
sp_nonce();
}
function sp_player_profile_meta( $post, $metabox ) {