From 18eee98728f20cd520e66fa129d3e068e13026af Mon Sep 17 00:00:00 2001 From: Takumi Date: Sat, 27 Jul 2013 21:23:27 +1000 Subject: [PATCH] Save player and staff as delimited single dimensional arrays --- actions.php | 5 +++-- event.php | 5 +++-- helpers.php | 17 ++++++++++++++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/actions.php b/actions.php index 0ca51ef8..6c029c05 100644 --- a/actions.php +++ b/actions.php @@ -101,8 +101,9 @@ function sp_save_post( $post_id ) { foreach ( $sportspress as $key => $value ): delete_post_meta( $post_id, $key ); if ( is_array( $value ) ): - foreach ( $value as $single_value ): - add_post_meta( $post_id, $key, $single_value, false ); + $values = new RecursiveIteratorIterator( new RecursiveArrayIterator( $value ) ); + foreach ( $values as $value ): + add_post_meta( $post_id, $key, $value, false ); endforeach; else: update_post_meta( $post_id, $key, $value ); diff --git a/event.php b/event.php index ddc6349c..078c81b2 100644 --- a/event.php +++ b/event.php @@ -36,6 +36,7 @@ function sp_event_team_meta( $post ) { $limit = get_option( 'sp_event_team_count' ); $teams = array_pad( array_slice( (array)get_post_meta( $post->ID, 'sp_team', false ), 0, $limit ), $limit, 0); $scores = array_pad( array_slice( (array)get_post_meta( $post->ID, 'sp_score', false ), 0, $limit ), $limit, 0); + $players = (array)get_post_meta( $post->ID, 'sp_player', false ); for ( $i = 0; $i < $limit; $i++ ): ?>
@@ -58,8 +59,8 @@ function sp_event_team_meta( $post ) {
  • ID, 'sp_player', false, 'block', 'sp_team' ); - sp_post_checklist( $post->ID, 'sp_staff', $i == $limit - 1, 'none', 'sp_team' ); + sp_post_checklist( $post->ID, 'sp_player', false, 'block', 'sp_team', $i ); + sp_post_checklist( $post->ID, 'sp_staff', $i == $limit - 1, 'none', 'sp_team', $i ); ?>
    - + ', sizeof( $parents ) ); ?>