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'


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/models/model.llms.student.php

	 *
	 * @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 );
				}

Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.