Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Student::insert_incompletion_postmeta( int $object_id, string $trigger = 'unspecified' )

Add student postmeta data for incompletion of a lesson, section, course or track An “_is_complete” value of “no” is inserted into postmeta

Parameters Parameters


(int) (Required) WP Post ID of the lesson, section, course or track


(string) (Optional) String describing the reason for mark incompletion

Default value: 'unspecified'

Top ↑

Return Return


Top ↑

Source Source

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

	private function insert_incompletion_postmeta( $object_id, $trigger = 'unspecified' ) {

		global $wpdb;

		// Add '_is_complete' to the user postmeta table for object.
		$user_metadatas = array(
			'_is_complete'        => 'no',
			'_completion_trigger' => $trigger,

		foreach ( $user_metadatas as $key => $value ) {

			 * It's too difficult to keep track of multiple postmetas for each lesson incomplete
			 * Instead, I'm just replacing the old '_is_complete' value with 'no'
			 * Lessons that have never been complete will not have an '_is_complete' record,
			 * Lessons that were completed will have an '_is_complete' record of 'yes',
			 * Lessons that have been completed once but were marked incomplete will have an '_is_complete' record of 'no'
			$update = $wpdb->update(
				$wpdb->prefix . 'lifterlms_user_postmeta',
					'user_id'      => $this->get_id(),
					'post_id'      => $object_id,
					'meta_key'     => $key,
					'meta_value'   => $value,
					'updated_date' => current_time( 'mysql' ),
					'user_id'  => $this->get_id(),
					'post_id'  => $object_id,
					'meta_key' => $key,
				array( '%d', '%d', '%s', '%s', '%s' )
			); // db call ok; no-cache ok.

			if ( false === $update ) {

				return false;


		return true;


Top ↑

Changelog Changelog

Version Description
3.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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