LLMS_Student::get_completion_date( int $object_id, string $format = 'F d, Y' )

Get the formatted date when a course or lesson was completed by the student

Parameters Parameters


(int) (Required) WP Post ID of a course or lesson


(string) (Optional) date format as accepted by php date()

Default value: 'F d, Y'

Top ↑

Return Return

(false|string) will return false if the user is not enrolled

Top ↑

Source Source

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

	public function get_completion_date( $object_id, $format = 'F d, Y' ) {

		global $wpdb;

		$q = $wpdb->get_var(
				"SELECT updated_date FROM {$wpdb->prefix}lifterlms_user_postmeta WHERE meta_key = '_is_complete' AND meta_value = 'yes' AND user_id = %d AND post_id = %d ORDER BY updated_date DESC LIMIT 1",
				array( $this->get_id(), $object_id )
		); // db call ok; no-cache ok.

		return ( $q ) ? date_i18n( $format, strtotime( $q ) ) : false;


Top ↑

Changelog Changelog

Version Description
?? Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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