LLMS_REST_Users_Controller::get_objects_query( array $prepared, WP_REST_Request $request )
Retrieve a query object based on arguments from a get_items()
(collection) request
Parameters Parameters
- $prepared
-
(array) (Required) Array of collection arguments.
- $request
-
(WP_REST_Request) (Required) Request object.
Return Return
(WP_User_Query)
Source Source
File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-users-controller.php
/** * Retrieve a query object based on arguments from a `get_items()` (collection) request * * @since 1.0.0-beta.1 * @since 1.0.0-beta.12 Parse `search` and `search_columns` args. * * @param array $prepared Array of collection arguments. * @param WP_REST_Request $request Request object. * @return WP_User_Query */ protected function get_objects_query( $prepared, $request ) { if ( 'id' === $prepared['orderby'] ) { $prepared['orderby'] = 'ID'; } elseif ( 'registered_date' === $prepared['orderby'] ) { $prepared['orderby'] = 'registered'; } $args = array( 'paged' => $prepared['page'], 'number' => $prepared['per_page'], 'order' => strtoupper( $prepared['order'] ), 'orderby' => $prepared['orderby'], ); if ( ! empty( $prepared['roles'] ) ) { $args['role__in'] = $prepared['roles']; } if ( ! empty( $prepared['include'] ) ) { $args['include'] = $prepared['include']; } if ( ! empty( $prepared['exclude'] ) ) { $args['exclude'] = $prepared['exclude']; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.12 | Parse search and search_columns args. |
1.0.0-beta.1 | Introduced. |