WPCW_UNITCOMPLETED::wpcw_unit_completed( $user_id,  $unit_id,  $parent )

Validation function when the trigger action is hit


Parameters Parameters

$user_id

(Required)

$unit_id

(Required)

$parent

(Required) AssociatedParentData


Source Source

File: src/integrations/wp-courseware/triggers/wpcw-unitcompleted.php

	public function wpcw_unit_completed( $user_id, $unit_id, $parent ) {

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