LLMS_Course_Data::get_engagements( string $type, string $period = 'current' )
Retrieve # of engagements related to the course awarded within the period
Parameters Parameters
- $type
-
(string) (Required) Engagement type [email|certificate|achievement].
- $period
-
(string) (Optional) Date period [current|previous]. Default is 'current'.
Default value: 'current'
Return Return
(int)
Source Source
File: includes/class.llms.course.data.php
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | public function get_engagements( $type , $period = 'current' ) { global $wpdb ; $ids = implode( ',' , $this ->get_all_ids() ); // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared return $wpdb ->get_var( $wpdb ->prepare( " SELECT DISTINCT COUNT ( user_id ) FROM { $wpdb ->prefix}lifterlms_user_postmeta WHERE meta_key = %s AND post_id IN ( { $ids } ) AND updated_date BETWEEN %s AND %s ", '_' . $type , $this ->get_date( $period , 'start' ), $this ->get_date( $period , 'end' ) ) ); // db call ok; no-cache ok. // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.15.0 | Introduced. |