WPLMS_UNITCOMPLETED::wplms_unit_completed( integer $unit_id, null $info, integer $user_id )

Validation function when the trigger action is hit


Parameters Parameters

$unit_id

(integer) (Required)

$info

(null) (Required)

$user_id

(integer) (Required)


Source Source

File: src/integrations/wplms/triggers/wplms-unitcompleted.php

	public function wplms_unit_completed( $unit_id, $info, $user_id ) {

		if ( ! $user_id ) {
			$user_id = get_current_user_id();
		}

		if ( empty( $user_id ) ) {
			return;
		}



		$args = [
			'code'    => $this->trigger_code,
			'meta'    => $this->trigger_meta,
			'post_id' => intval( $unit_id ),
			'user_id' => $user_id,
		];

		Automator()->maybe_add_trigger_entry( $args );
	}