@@ -718,55 +718,46 @@ public function filters_form() {
718718 }
719719
720720 public function filter_select ( $ name , $ title , $ items , $ ajax = false ) {
721- if ( $ ajax ) {
722- $ out = sprintf (
723- '<input type="hidden" name="%s" class="chosen-select" value="%s" data-placeholder="%s" /> ' ,
724- esc_attr ( $ name ),
725- esc_attr ( wp_stream_filter_input ( INPUT_GET , $ name ) ),
726- esc_attr ( $ title )
721+ $ options = array ( '<option value=""></option> ' );
722+ $ selected = wp_stream_filter_input ( INPUT_GET , $ name );
723+
724+ foreach ( $ items as $ key => $ item ) {
725+ $ value = isset ( $ item ['children ' ] ) ? 'group- ' . $ key : $ key ;
726+ $ option_args = array (
727+ 'value ' => $ value ,
728+ 'selected ' => selected ( $ value , $ selected , false ),
729+ 'disabled ' => isset ( $ item ['disabled ' ] ) ? $ item ['disabled ' ] : null ,
730+ 'icon ' => isset ( $ item ['icon ' ] ) ? $ item ['icon ' ] : null ,
731+ 'group ' => isset ( $ item ['children ' ] ) ? $ key : null ,
732+ 'tooltip ' => isset ( $ item ['tooltip ' ] ) ? $ item ['tooltip ' ] : null ,
733+ 'class ' => isset ( $ item ['children ' ] ) ? 'level-1 ' : null ,
734+ 'label ' => isset ( $ item ['label ' ] ) ? $ item ['label ' ] : null ,
727735 );
728- } else {
729- $ options = array ( '<option value=""></option> ' );
730- $ selected = wp_stream_filter_input ( INPUT_GET , $ name );
731-
732- foreach ( $ items as $ key => $ item ) {
733- $ value = isset ( $ item ['children ' ] ) ? 'group- ' . $ key : $ key ;
734- $ option_args = array (
735- 'value ' => $ value ,
736- 'selected ' => selected ( $ value , $ selected , false ),
737- 'disabled ' => isset ( $ item ['disabled ' ] ) ? $ item ['disabled ' ] : null ,
738- 'icon ' => isset ( $ item ['icon ' ] ) ? $ item ['icon ' ] : null ,
739- 'group ' => isset ( $ item ['children ' ] ) ? $ key : null ,
740- 'tooltip ' => isset ( $ item ['tooltip ' ] ) ? $ item ['tooltip ' ] : null ,
741- 'class ' => isset ( $ item ['children ' ] ) ? 'level-1 ' : null ,
742- 'label ' => isset ( $ item ['label ' ] ) ? $ item ['label ' ] : null ,
743- );
744- $ options [] = $ this ->filter_option ( $ option_args );
745-
746- if ( isset ( $ item ['children ' ] ) ) {
747- foreach ( $ item ['children ' ] as $ child_value => $ child_item ) {
748- $ option_args = array (
749- 'value ' => $ child_value ,
750- 'selected ' => selected ( $ child_value , $ selected , false ),
751- 'disabled ' => isset ( $ child_item ['disabled ' ] ) ? $ child_item ['disabled ' ] : null ,
752- 'icon ' => isset ( $ child_item ['icon ' ] ) ? $ child_item ['icon ' ] : null ,
753- 'group ' => $ key ,
754- 'tooltip ' => isset ( $ child_item ['tooltip ' ] ) ? $ child_item ['tooltip ' ] : null ,
755- 'class ' => 'level-2 ' ,
756- 'label ' => isset ( $ child_item ['label ' ] ) ? '- ' . $ child_item ['label ' ] : null ,
757- );
758- $ options [] = $ this ->filter_option ( $ option_args );
759- }
736+ $ options [] = $ this ->filter_option ( $ option_args );
737+
738+ if ( isset ( $ item ['children ' ] ) ) {
739+ foreach ( $ item ['children ' ] as $ child_value => $ child_item ) {
740+ $ option_args = array (
741+ 'value ' => $ child_value ,
742+ 'selected ' => selected ( $ child_value , $ selected , false ),
743+ 'disabled ' => isset ( $ child_item ['disabled ' ] ) ? $ child_item ['disabled ' ] : null ,
744+ 'icon ' => isset ( $ child_item ['icon ' ] ) ? $ child_item ['icon ' ] : null ,
745+ 'group ' => $ key ,
746+ 'tooltip ' => isset ( $ child_item ['tooltip ' ] ) ? $ child_item ['tooltip ' ] : null ,
747+ 'class ' => 'level-2 ' ,
748+ 'label ' => isset ( $ child_item ['label ' ] ) ? '- ' . $ child_item ['label ' ] : null ,
749+ );
750+ $ options [] = $ this ->filter_option ( $ option_args );
760751 }
761752 }
762- $ out = sprintf (
763- '<select name="%s" class="chosen-select" data-placeholder="%s">%s</select> ' ,
764- esc_attr ( $ name ),
765- // translators: Placeholder refers to the title of the dropdown menu (e.g. "users")
766- sprintf ( esc_attr__ ( 'Show all %s ' , 'stream ' ), $ title ),
767- implode ( '' , $ options )
768- );
769753 }
754+ $ out = sprintf (
755+ '<select name="%s" class="chosen-select" data-placeholder="%s">%s</select> ' ,
756+ esc_attr ( $ name ),
757+ // translators: Placeholder refers to the title of the dropdown menu (e.g. "users")
758+ sprintf ( esc_attr__ ( 'Show all %s ' , 'stream ' ), $ title ),
759+ implode ( '' , $ options )
760+ );
770761
771762 return $ out ;
772763 }
@@ -895,6 +886,7 @@ public function record_actions_form() {
895886 }
896887 echo '</select></div> ' ;
897888 wp_nonce_field ( 'stream_record_actions_nonce ' , 'stream_record_actions_nonce ' );
889+ wp_nonce_field ( 'stream_filters_user_search_nonce ' , 'stream_filters_user_search_nonce ' );
898890
899891 printf ( '<input type="hidden" name="page" value="%s"> ' , esc_attr ( wp_stream_filter_input ( INPUT_GET , 'page ' ) ) );
900892 printf ( '<input type="hidden" name="date_predefined" value="%s"> ' , esc_attr ( wp_stream_filter_input ( INPUT_GET , 'date_predefined ' ) ) );
0 commit comments