UT_GROUP_LEADER_IMPORTED::complete_trigger( $meta_value,  $args,  $group_id )

Running a complete trigger function


Parameters Parameters

$meta_value

(Required)

$args

(Required)

$group_id

(Required)


Source Source

File: src/integrations/uncanny-toolkit/triggers/ut-group-leader-imported.php

	public function complete_trigger( $meta_value, $args, $group_id ) {

		$results                             = Automator()->process->user->maybe_add_trigger_entry( $args, false );
		$meta_value['learndash_group_id']    = $group_id;
		$meta_value['learndash_group_title'] = get_the_title( $group_id );
		$serialized                          = maybe_serialize( $meta_value );
		if ( empty( $results ) ) {
			return;
		}
		foreach ( $results as $rr ) {
			if ( ! $rr['result'] ) {
				continue;
			}
			$trigger_id     = (int) $rr['args']['trigger_id'];
			$user_id        = (int) $rr['args']['user_id'];
			$trigger_log_id = (int) $rr['args']['trigger_log_id'];
			$run_number     = (int) $rr['args']['run_number'];
			$token_args     = array(
				'user_id'        => $user_id,
				'trigger_id'     => $trigger_id,
				'run_number'     => $run_number, //get run number
				'trigger_log_id' => $trigger_log_id,
			);

			Automator()->db->trigger->add_token_meta( 'imported_row', $serialized, $token_args );
			Automator()->process->user->maybe_trigger_complete( $rr['args'] );
		}
	}