diff --git a/admin.js b/admin.js index 2a3be8e..b2c170d 100644 --- a/admin.js +++ b/admin.js @@ -160,6 +160,7 @@ window.camptix = window.camptix || { models: {}, views: {}, collections: {} }; question: '', values: '', required: false, + include_in_email: false, order: 0, json: '' } @@ -427,7 +428,8 @@ window.camptix = window.camptix || { models: {}, views: {}, collections: {} }; // Make sure post_id and required are correct types, not integers. question.set( { post_id: parseInt( question.get( 'post_id' ), 10 ), - required: !! parseInt( question.get( 'required' ), 10 ) + required: !! parseInt( question.get( 'required' ), 10 ), + include_in_email: !! parseInt( question.get( 'include_in_email' ), 10 ) }, { silent: true } ); var found = camptix.questions.where( { post_id: parseInt( question.get( 'post_id' ), 10 ) } ); diff --git a/camptix.php b/camptix.php index 115dbd2..fad8a82 100644 --- a/camptix.php +++ b/camptix.php @@ -1400,6 +1400,7 @@ protected function run_upgrade_parts( $from ) { // Save attributes, including the key for future use. update_post_meta( $question_id, 'tix_values', $question['values'] ); update_post_meta( $question_id, 'tix_required', $question['required'] ); + update_post_meta( $question_id, 'tix_include_in_email', $question['include_in_email'] ); update_post_meta( $question_id, 'tix_type', $question['type'] ); update_post_meta( $question_id, 'tix_key', $key ); @@ -4293,6 +4294,14 @@ function metabox_ticket_questions() { +
@@ -4322,6 +4331,7 @@ function metabox_ticket_questions() { + @@ -4368,6 +4378,7 @@ function metabox_ticket_questions() { type: 'ID, 'tix_type', true ) ); ?>', question: 'post_title ) ); ?>', required: ID, 'tix_required', true ) ); ?>, + include_in_email: ID, 'tix_include_in_email', true ) ); ?>, values: 'ID, 'tix_values', true ) ) ); ?>' } ) ); @@ -4643,9 +4654,11 @@ function save_ticket_post( $post_id ) { 'type' => $question['type'], 'values' => $question_values, 'required' => isset( $question['required'] ), + 'include_in_email' => isset( $question['include_in_email'] ), ); $clean_question['required'] = (bool) $question['required']; + $clean_question['include_in_email'] = (bool) $question['include_in_email']; $question = $clean_question; unset( $clean_question ); @@ -4677,6 +4690,7 @@ function save_ticket_post( $post_id ) { // Question meta update_post_meta( $question_id, 'tix_values', $question['values'] ); update_post_meta( $question_id, 'tix_required', $question['required'] ); + update_post_meta( $question_id, 'tix_include_in_email', $question['include_in_email'] ); update_post_meta( $question_id, 'tix_type', $question['type'] ); // Don't add duplicate questions to the ticket/order. @@ -5501,11 +5515,12 @@ function form_attendee_info() { ID ); - $value = isset( $this->form_data['tix_attendee_questions'][ $i ][ $question->ID ] ) ? $this->form_data['tix_attendee_questions'][ $i ][ $question->ID ] : ''; - $type = get_post_meta( $question->ID, 'tix_type', true ); - $required = get_post_meta( $question->ID, 'tix_required', true ); - $class_name = 'tix-row-question-' . $question->ID; + $name = sprintf( 'tix_attendee_questions[%d][%s]', $i, $question->ID ); + $value = isset( $this->form_data['tix_attendee_questions'][ $i ][ $question->ID ] ) ? $this->form_data['tix_attendee_questions'][ $i ][ $question->ID ] : ''; + $type = get_post_meta( $question->ID, 'tix_type', true ); + $required = get_post_meta( $question->ID, 'tix_required', true ); + $include_in_email = get_post_meta( $question->ID, 'tix_include_in_email', true ); + $class_name = 'tix-row-question-' . $question->ID; ?>