Skip to content

Commit 32c7d9e

Browse files
committed
where args issue fix for review function
1 parent 8a3459e commit 32c7d9e

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

classes/Utils.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4266,15 +4266,13 @@ public function get_reviews_by_instructor( $instructor_id = 0, $offset = 0, $lim
42664266
$course_id = sanitize_text_field( $course_id );
42674267
$date_filter = sanitize_text_field( $date_filter );
42684268
$instructor_id = $this->get_user_id( $instructor_id );
4269-
$args = $this->sanitize_array( $args );
42704269

42714270
$course_query = '';
42724271
$date_query = '';
4273-
42744272
$where_clause = '';
42754273

4276-
if ( ! empty( $args['where'] ) ) {
4277-
$where_clause = ' AND ' . $args['where'];
4274+
if ( ! empty( $args['where'] ) && is_array( $args['where'] ) ) {
4275+
$where_clause = count( $args['where'] ) ? ' AND ' . QueryHelper::prepare_where_clause( $args['where'] ) : '';
42784276
}
42794277

42804278
if ( '' !== $course_id ) {

templates/dashboard/instructor/home.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ function ( $carry, $section ) {
330330
if ( ! $is_all_time ) {
331331
$review_where['comment_date'] = array( 'BETWEEN', array( $start_date, $end_date ) );
332332
}
333-
$review_args = array( 'where' => QueryHelper::prepare_where_clause( $review_where ) );
333+
$review_args = array( 'where' => $review_where );
334334
$reviews = tutor_utils()->get_reviews_by_instructor( $user->ID, 0, 3, '', '', $review_args );
335335
$recent_reviews = Instructor::format_instructor_recent_reviews( $reviews->results );
336336
?>

0 commit comments

Comments
 (0)