TUTORLMS_COURSECOMPLETED::complete()

Validates Trigger.


Source Source

File: src/integrations/tutorlms/triggers/tutorlms-coursecompleted.php

	public function complete() {
		// global post object.
		global $post;
		// Is this the registered lesson post type
		if ( tutor()->course_post_type !== $post->post_type ) {
			return;
		}
		// current user.
		$user_id = get_current_user_id();
		// trigger entry args.
		$args = [
			'code'    => $this->trigger_code,
			'meta'    => $this->trigger_meta,
			'post_id' => $post->ID,
			'user_id' => $user_id,
		];

		// run trigger.
		Automator()->maybe_add_trigger_entry( $args );
	}

Changelog Changelog

Changelog
VersionDescription
2.4.0Introduced.