LLMS_Student::get_achievements( string $orderby = 'updated_date', string $order = 'DESC', string $return = 'obj' )
Retrieve achievements 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 achievements => array of LLMS_User_Achievement instances
Default value: 'obj'
Return Return
(array)
Source Source
File: includes/models/model.llms.student.php
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | * * @since 3.0.0 * @since 5.7.0 Replaced the call to the deprecated `LLMS_Lesson::get_parent_course()` method with `LLMS_Lesson::get( 'parent_course' )`. * * @param int $product_id WP Post ID of the LifterLMS Product (course, lesson, or membership) * @ return LLMS_Order|false Instance of the LLMS_Order or false if none found */ public function get_enrollment_order( $product_id ) { // If a lesson id was passed in, cascade up to the course for order retrieval. if ( 'lesson' === get_post_type( $product_id ) ) { $lesson = new LLMS_Lesson( $product_id ); $product_id = $lesson ->get( 'parent_course' ); } // Attempt to locate the order via the enrollment trigger. $trigger = $this ->get_enrollment_trigger( $product_id ); if ( strpos ( $trigger , 'order_' ) !== false ) { $id = str_replace ( array ( 'order_' , 'wc_' ), '' , $trigger ); if ( is_numeric ( $id ) ) { if ( 'llms_order' === get_post_type( $id ) ) { return new LLMS_Order( $id ); } else { return get_post( $id ); } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
2.4.0 | Introduced. |