| 753 | $inc_fresh_topics = !empty( $instance['inc_fresh_topics'] ) ? $instance['inc_fresh_topics'] : false; |
| 754 | |
| 755 | // Do we want to include fresh topics with no replies |
| 756 | switch ( $inc_fresh_topics ) { |
| 757 | |
| 758 | // Include new topics with no replies with replies created most recently |
| 759 | case 'yes' : |
| 760 | $replies_query = array( |
| 761 | 'post_type' => $post_types, |
| 762 | 'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), |
| 763 | 'posts_per_page' => $max_shown, |
| 764 | 'meta_query' => array( bbp_exclude_forum_ids( 'meta_query' ) ) |
| 765 | ); |
| 766 | break; |
| 767 | |
| 768 | // Show replies created most recently |
| 769 | case 'no' : |
| 770 | default : |
| 771 | $replies_query = array( |
| 772 | 'post_type' => $post_types, |
| 773 | 'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), |
| 774 | 'posts_per_page' => $max_shown, |
| 775 | 'meta_query' => array( bbp_exclude_forum_ids( 'meta_query' ) ) |
| 776 | ); |
| 777 | break; |
| 778 | } |
832 | | $instance = $old_instance; |
833 | | $instance['title'] = strip_tags( $new_instance['title'] ); |
834 | | $instance['max_shown'] = strip_tags( $new_instance['max_shown'] ); |
835 | | $instance['show_date'] = strip_tags( $new_instance['show_date'] ); |
836 | | $instance['show_user'] = strip_tags( $new_instance['show_user'] ); |
| 858 | $instance = $old_instance; |
| 859 | $instance['title'] = strip_tags( $new_instance['title'] ); |
| 860 | $instance['max_shown'] = strip_tags( $new_instance['max_shown'] ); |
| 861 | $instance['show_date'] = strip_tags( $new_instance['show_date'] ); |
| 862 | $instance['show_user'] = strip_tags( $new_instance['show_user'] ); |
| 863 | $instance['inc_fresh_topics'] = strip_tags( $new_instance['inc_fresh_topics']); |
851 | | $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
852 | | $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : ''; |
853 | | $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; |
854 | | $show_user = !empty( $instance['show_user'] ) ? esc_attr( $instance['show_user'] ) : ''; ?> |
| 878 | $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
| 879 | $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : ''; |
| 880 | $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; |
| 881 | $show_user = !empty( $instance['show_user'] ) ? esc_attr( $instance['show_user'] ) : ''; |
| 882 | $inc_fresh_topics = !empty( $instance['inc_fresh_topics'] ) ? esc_attr( $instance['inc_fresh_topics'] ) : ''; ?> ?> |
855 | 883 | |
856 | 884 | <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p> |
857 | 885 | <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum replies to show:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_shown' ); ?>" name="<?php echo $this->get_field_name( 'max_shown' ); ?>" type="text" value="<?php echo $max_shown; ?>" /></label></p> |
858 | 886 | <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( 'on', $show_date ); ?> /></label></p> |
859 | 887 | <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show reply author:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( 'on', $show_user ); ?> /></label></p> |