LLMS_REST_Students_Controller::get_objects_query_pre( WP_User_Query $query )
Callback for WP_User_Query “pre_user_query” action.
Description Description
Adds select fields and a having clause to check against enrolled_in
and enrolled_not_in
collection query args.
Parameters Parameters
- $query
-
(WP_User_Query) (Required) Query object.
Return Return
(void)
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-students-controller.php
} } if ( ! empty( $this->prepared_query_args['enrolled_not_in'] ) ) { foreach ( $this->prepared_query_args['enrolled_not_in'] as $post_id ) { $post_id = absint( $post_id ); $query->query_fields .= ", {$this->get_objects_query_status_subquery( $post_id )}"; $query->query_where .= " AND ( p_{$post_id}_stat IS NULL OR p_{$post_id}_stat != 'enrolled' )"; } } } /** * Generates a subquery to check a user's enrollment status for a given course or membership. * * @since 1.0.0-beta.1 * * @param int $post_id Course or membership id. * @return string */
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.1 | Introduced. |