LLMS_Analytics_Enrollments_Widget::set_query()
Contents
Source Source
File: includes/admin/reporting/widgets/class.llms.analytics.widget.enrollments.php
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 ) . ' )'; } $product_ids = ''; $products = $this->get_posted_posts(); if ( $products ) { $product_ids .= 'AND post_id IN ( ' . implode( ', ', $products ) . ' )'; } $this->query_function = 'get_results'; $this->output_type = OBJECT; $this->query = "SELECT updated_date AS date FROM {$wpdb->prefix}lifterlms_user_postmeta WHERE meta_key = '_status' AND ( meta_value = 'Enrolled' OR meta_value = 'enrolled' ) AND updated_date BETWEEN CAST( %s AS DATETIME ) AND CAST( %s AS DATETIME ) {$student_ids} {$product_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