PluginProbe
Tutor LMS – eLearning and online course solution / 2.7.3
Tutor LMS – eLearning and online course solution v2.7.3
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 All 191 releases
← All changes | classes/Shortcode.php +31 -8 2.7.22.7.3 View file →
@@ -155,16 +155,30 @@
155 155 ),
156 156 $atts
157 157 );
158 158
159 + $supported_filters = tutor_utils()->get_option( 'supported_course_filters', array() );
160 + $course_filter_category = array();
161 + $course_filter_exclude_ids = array();
162 + $course_filter_post_ids = array();
163 +
159 164 if ( ! empty( $a['id'] ) ) {
160 165 $ids = (array) explode( ',', $a['id'] );
161 166 $a['post__in'] = $ids;
167 +
168 + if ( is_array( $ids ) && count( $ids ) && ! wp_doing_ajax() ) {
169 + $_GET['tutor-course-filter-post-ids'] = $ids;
170 + $course_filter_post_ids = $ids;
171 + }
162 172 }
163 173
164 174 if ( ! empty( $a['exclude_ids'] ) ) {
165 175 $exclude_ids = (array) explode( ',', $a['exclude_ids'] );
166 176 $a['post__not_in'] = $exclude_ids;
177 + if ( is_array( $exclude_ids ) && count( $exclude_ids ) && ! wp_doing_ajax() ) {
178 + $_GET['tutor-course-filter-exclude-ids'] = $exclude_ids;
179 + $course_filter_exclude_ids = $exclude_ids;
180 + }
167 181 }
168 182 if ( ! empty( $a['category'] ) ) {
169 183 $category = (array) explode( ',', $a['category'] );
170 184
@@ -192,8 +206,14 @@
192 206 'terms' => $category_ids,
193 207 'operator' => 'IN',
194 208 ),
195 209 );
210 +
211 + if ( is_array( $category_ids ) && count( $category_ids ) && ! wp_doing_ajax() ) {
212 + $_GET['tutor-course-filter-category'] = $category_ids;
213 + $course_filter_category = $category_ids;
214 + unset( $supported_filters['category'] );
215 + }
196 216 }
197 217
198 218 if ( ! empty( $category_names ) ) {
199 219 $a['tax_query'] = array(
@@ -228,16 +248,19 @@
228 248 if ( $the_query->have_posts() ) {
229 249 tutor_load_template(
230 250 'archive-course-init',
231 251 array(
232 - 'course_filter' => isset( $atts['course_filter'] ) && 'on' === $atts['course_filter'],
233 - 'supported_filters' => tutor_utils()->get_option( 'supported_course_filters', array() ),
234 - 'loop_content_only' => false,
235 - 'column_per_row' => isset( $atts['column_per_row'] ) ? $atts['column_per_row'] : null,
236 - 'course_per_page' => $a['posts_per_page'],
237 - 'show_pagination' => isset( $atts['show_pagination'] ) && 'on' === $atts['show_pagination'],
238 - 'the_query' => $the_query,
239 - 'current_page' => isset( $get['current_page'] ) ? (int) $get['current_page'] : 1,
252 + 'course_filter' => isset( $atts['course_filter'] ) && 'on' === $atts['course_filter'],
253 + 'supported_filters' => $supported_filters,
254 + 'loop_content_only' => false,
255 + 'column_per_row' => isset( $atts['column_per_row'] ) ? $atts['column_per_row'] : null,
256 + 'course_per_page' => $a['posts_per_page'],
257 + 'show_pagination' => isset( $atts['show_pagination'] ) && 'on' === $atts['show_pagination'],
258 + 'the_query' => $the_query,
259 + 'current_page' => isset( $get['current_page'] ) ? (int) $get['current_page'] : 1,
260 + 'course_filter_category' => ! empty( $course_filter_category ) ? json_encode( $course_filter_category ) : null,
261 + 'course_filter_exclude_ids' => ! empty( $course_filter_exclude_ids ) ? json_encode( $course_filter_exclude_ids ) : null,
262 + 'course_filter_post_ids' => ! empty( $course_filter_post_ids ) ? json_encode( $course_filter_post_ids ) : null,
240 263 )
241 264 );
242 265 } else {
243 266 tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() );