@@ -936,46 +936,6 @@ function get_all_questions() {
936
936
return $ questions ;
937
937
}
938
938
939
- /**
940
- * Takes a ticket id and returns a sorted array of questions.
941
- *
942
- * @param int $ticket_id
943
- *
944
- * @return array
945
- */
946
- function get_sorted_questions ( $ ticket_id ) {
947
- $ question_ids = (array ) get_post_meta ( $ ticket_id , 'tix_question_id ' );
948
- $ order = (array ) get_post_meta ( $ ticket_id , 'tix_questions_order ' , true );
949
-
950
- // Make sure we have at least some questions
951
- if ( empty ( $ question_ids ) )
952
- return array ();
953
-
954
- $ questions = get_posts ( array (
955
- 'post_type ' => 'tix_question ' ,
956
- 'post_status ' => 'publish ' ,
957
- 'posts_per_page ' => -1 ,
958
- 'post__in ' => $ question_ids ,
959
- ) );
960
-
961
- $ questions_with_keys = array ();
962
-
963
- foreach ( $ questions as $ question )
964
- $ questions_with_keys [ $ question ->ID ] = $ question ;
965
-
966
- $ questions = $ questions_with_keys ;
967
- unset( $ questions_with_keys );
968
-
969
- $ questions_sorted = array ();
970
- foreach ( $ order as $ question_id )
971
- if ( isset ( $ questions [ $ question_id ] ) )
972
- $ questions_sorted [] = $ questions [ $ question_id ];
973
-
974
- unset( $ questions );
975
-
976
- return $ questions_sorted ;
977
- }
978
-
979
939
/**
980
940
* Fired during init, registers our new post types. $supports depends
981
941
* on $this->debug, which if true, renders things like custom fields.
@@ -4400,7 +4360,7 @@ function metabox_ticket_questions() {
4400
4360
</div>
4401
4361
</div>
4402
4362
<?php
4403
- $ questions = $ this -> get_sorted_questions ( get_the_ID () );
4363
+ $ questions = CampTix_Utility:: get_sorted_questions ( get_the_ID () );
4404
4364
$ i = 0 ;
4405
4365
?>
4406
4366
</div>
@@ -4715,7 +4675,7 @@ function metabox_attendee_info() {
4715
4675
4716
4676
// Questions
4717
4677
$ rows [] = array ( __ ( 'Questions ' , 'wordcamporg ' ), '' );
4718
- $ questions = $ this -> get_sorted_questions ( $ ticket_id );
4678
+ $ questions = CampTix_Utility:: get_sorted_questions ( $ ticket_id );
4719
4679
$ answers = get_post_meta ( $ post ->ID , 'tix_questions ' , true );
4720
4680
4721
4681
foreach ( $ questions as $ question ) {
@@ -5862,7 +5822,7 @@ function form_attendee_info() {
5862
5822
5863
5823
<?php
5864
5824
$ ticket = $ this ->tickets [$ ticket_id ];
5865
- $ questions = $ this -> get_sorted_questions ( $ ticket ->ID );
5825
+ $ questions = CampTix_Utility:: get_sorted_questions ( $ ticket ->ID );
5866
5826
$ this ->form_data ['tix_attendee_info ' ][ $ i ]['ticket_id ' ] = intval ( $ ticket ->ID );
5867
5827
?>
5868
5828
<input type="hidden" name="tix_attendee_info[<?php echo esc_attr ( $ i ); ?> ][ticket_id]" value="<?php echo intval ( $ ticket ->ID ); ?> " />
@@ -6231,7 +6191,7 @@ function form_edit_attendee() {
6231
6191
$ this ->notice ( __ ( 'Please note that the payment for this ticket is still pending. ' , 'wordcamporg ' ) );
6232
6192
6233
6193
$ ticket = get_post ( $ ticket_id );
6234
- $ questions = $ this -> get_sorted_questions ( $ ticket ->ID );
6194
+ $ questions = CampTix_Utility:: get_sorted_questions ( $ ticket ->ID );
6235
6195
$ answers = (array ) get_post_meta ( $ attendee ->ID , 'tix_questions ' , true );
6236
6196
6237
6197
$ ticket_info = array (
@@ -7162,7 +7122,7 @@ function form_checkout() {
7162
7122
7163
7123
$ answers = array ();
7164
7124
if ( isset ( $ _POST ['tix_attendee_questions ' ][ $ i ] ) ) {
7165
- $ questions = $ this -> get_sorted_questions ( $ ticket ->ID );
7125
+ $ questions = CampTix_Utility:: get_sorted_questions ( $ ticket ->ID );
7166
7126
7167
7127
foreach ( $ questions as $ question ) {
7168
7128
if ( isset ( $ _POST ['tix_attendee_questions ' ][ $ i ][ $ question ->ID ] ) ) {
0 commit comments