LLMS_Analytics_Lessoncompletions_Widget::set_query()
Contents
Source Source
File: includes/admin/reporting/widgets/class.llms.analytics.widget.lessoncompletions.php
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | public function set_query() { global $wpdb ; $dates = $this ->get_posted_dates(); $student_ids = '' ; $students = $this ->get_posted_students(); if ( $students ) { $student_ids .= 'AND user_id IN ( ' . implode( ', ' , $students ) . ' )' ; } $lesson_ids = '' ; $products = $this ->get_posted_posts(); if ( $products ) { $lesson_ids .= 'AND post_id IN ( ' . implode( ', ' , $this ->get_lesson_ids( $products ) ) . ' )' ; } $this ->query_function = 'get_results' ; $this ->output_type = OBJECT; $this ->query = "SELECT updated_date AS date FROM { $wpdb ->prefix}lifterlms_user_postmeta AS upm JOIN { $wpdb ->posts} AS p ON p.ID = upm.post_id WHERE upm.meta_key = '_is_complete' AND p.post_type = 'lesson' AND upm.meta_value = 'yes' AND upm.updated_date BETWEEN CAST( %s AS DATETIME ) AND CAST( %s AS DATETIME ) { $student_ids } { $lesson_ids } ;"; $this ->query_vars = array ( $this ->format_date( $dates [ 'start' ], 'start' ), $this ->format_date( $dates [ 'end' ], 'end' ), ); } |
Expand full source code Collapse full source code View on GitHub