learndash_reports_get_activity( $query_args = array(), int $current_user_id )
Queries the user activity for the report.
Description #
This function will query the new learndash_course_user_activity table for user/course Activity.
Parameters #
-
(<span class="arrayarray<string,) (Required) mixed> $query_args Optional. The query arguments to get user activity. Default empty array.
- $current_user_id
-
(int) (Optional) The user to run the query as. Defaults to the current user. Default 0.
Return #
(array|int) Returns user activity query results or the number of items if 'return_count_only' in $query_args is set to true.
Source #
File: includes/ld-reports.php
Changelog #
Version | Description |
---|---|
4.21.1 | NOT_STARTED data is now included properly in the results. If you need to include *all* "access" activities for a User/Course combination, set 'always_include_access_results' to true in $query_args. By default, if a User/Course combination would have IN_PROGRESS or COMPLETED activities, access activities are not included. |
4.20.5 | Changed the main table to query from to 'wp_learndash_user_activity' instead of 'wp_users'. 4.20.5 Activity meta fields are fetched via a join query. Added the 'return_count_only' parameter to the $query_args. |
2.3.0 | Introduced. |