LLMS_Student::get_certificates( string $orderby = 'updated_date', string $order = 'DESC', string $return = 'obj' )
Retrieve certificates that a user has earned
Parameters Parameters
- $orderby
-
(string) (Optional) field to order the returned results by
Default value: 'updated_date'
- $order
-
(string) (Optional) ordering method for returned results (ASC or DESC)
Default value: 'DESC'
- $return
-
(string) (Optional) return type obj => array of objects from $wpdb->get_results certificates => array of LLMS_User_Certificate instances
Default value: 'obj'
Return Return
(array)
Source Source
File: includes/models/model.llms.student.php
AND upm.meta_key = '_is_complete' AND upm.meta_value = 'yes' AND upm.user_id = %d ORDER BY {$args['orderby']} {$args['order']} LIMIT %d, %d; ", array( $this->get_id(), $args['skip'], $args['limit'], ) ), 'OBJECT_K' ); // db call ok; no-cache ok. // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared $ids = array_keys( $q ); $more = false; // If we hit our limit we have too many results, pop the last one. if ( count( $ids ) === $args['limit'] ) { array_pop( $ids ); $more = true; } // Reset args to pass back for pagination. $args['limit']--;
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
2.4.0 | Introduced. |