Skip to content

Commit

Permalink
= 4.2.6.6 =
Browse files Browse the repository at this point in the history
~ Tweak: get_total_user_enrolled method.
  • Loading branch information
tungnxt89 committed Apr 19, 2024
1 parent 227f290 commit a5e4bf4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions inc/Databases/class-lp-course-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ public function get_total_user_enrolled( int $course_id ): int {
SELECT COUNT(DISTINCT user_id) AS total FROM {$this->tb_lp_user_items}
WHERE item_id = %d
AND item_type = %s
AND user_id > 0
AND (status = %s OR status = %s )
",
$course_id,
Expand Down Expand Up @@ -348,6 +349,7 @@ public function get_total_user_enrolled_or_purchased( int $course_id ): int {
SELECT COUNT(DISTINCT user_id) AS total FROM {$this->tb_lp_user_items}
WHERE item_id = %d
AND item_type = %s
AND user_id > 0
AND (status = %s OR status = %s OR status = %s )
",
$course_id,
Expand Down
1 change: 1 addition & 0 deletions inc/Databases/class-lp-user-items-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,7 @@ public function count_students( LP_User_Items_Filter $filter ): int {
$filter->only_fields = [ 'ui.user_id' ];
$filter->field_count = 'ui.user_id';
$filter->item_type = LP_COURSE_CPT;
$filter->where[] = 'AND ui.user_id != 0';
$this->get_user_items( $filter, $count );
} catch ( Throwable $e ) {
error_log( __METHOD__ . ': ' . $e->getMessage() );
Expand Down

0 comments on commit a5e4bf4

Please # to comment.