Skip to content

Commit 6f90e87

Browse files
author
Chris Gårdenberg
committed
fix: Custom course detail views will no longer require an attribute to show on demand events.
1 parent 9a6c631 commit 6f90e87

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

PLUGIN-CHECKSUM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d60c86a7ef5ab86df88765cafd2408f7
1+
d9a3abfe0d6b3d0d3d87d1abe302123c

includes/edu-shortcodes.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,6 @@ function eduadmin_get_detailinfo( $attributes ) {
420420
'courseinquiryurl' => null,
421421
'order' => null,
422422
'orderby' => null,
423-
'ondemand' => false,
424423
'allcourses' => false,
425424
),
426425
normalize_empty_atts( $attributes ),
@@ -464,18 +463,18 @@ function eduadmin_get_detailinfo( $attributes ) {
464463
$fetch_months = 6;
465464
}
466465

467-
if ( ! $attributes['ondemand'] ) {
468-
$edo = EDUAPIHelper()->GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city );
469-
} else {
470-
$edo = EDUAPIHelper()->GetOnDemandCourseDetailInfo( $course_id, $group_by_city );
471-
}
472-
473-
$selected_course = false;
466+
$edo = EDUAPIHelper()->GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city );
474467

475468
if ( ! empty( $edo ) ) {
476469
$selected_course = json_decode( $edo, true );
477470
}
478471

472+
$is_ondemand = $selected_course['OnDemand'];
473+
474+
if ( $is_ondemand ) {
475+
$selected_course = json_decode( EDUAPIHelper()->GetOnDemandCourseDetailInfo( $course_id, $group_by_city ), true );
476+
}
477+
479478
if ( ! is_array( $selected_course ) ) {
480479
EDU()->stop_timer( $t );
481480

@@ -742,7 +741,7 @@ function eduadmin_get_detailinfo( $attributes ) {
742741
$ret_str .= ' data-orderby="' . esc_attr( $custom_order_by_order ) . '"';
743742
$ret_str .= ' data-showvenue="' . esc_attr( EDU()->is_checked( 'eduadmin-showEventVenueName', false ) ) . '"';
744743
$ret_str .= ' data-eventinquiry="' . esc_attr( EDU()->is_checked( 'eduadmin-allowInterestRegEvent', false ) ) . '"';
745-
$ret_str .= ' data-ondemand="' . esc_attr( $attributes['ondemand'] ) . '"';
744+
$ret_str .= ' data-ondemand="' . esc_attr( $is_ondemand ) . '"';
746745
$ret_str .= ' data-allcourses="' . esc_attr( $attributes['allcourses'] ) . '"';
747746
$ret_str .= '>';
748747

0 commit comments

Comments
 (0)