LLMS_Course_Data::get_enrollments( string $period = 'current' )
Retrieve # of course enrollments within the period
Parameters Parameters
- $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
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | public function get_enrollments( $period = 'current' ) { global $wpdb ; return $wpdb ->get_var( $wpdb ->prepare( " SELECT DISTINCT COUNT ( user_id ) FROM { $wpdb ->prefix}lifterlms_user_postmeta WHERE meta_value = 'yes' AND meta_key = '_start_date' AND post_id = %d AND updated_date BETWEEN %s AND %s ", $this ->post_id, $this ->get_date( $period , 'start' ), $this ->get_date( $period , 'end' ) ) ); // db call ok; no-cache ok. } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.31.0 | Use $this->post_id instead of deprecated $this->course_id. |
3.15.0 | Introduced. |