LD_MARKTOPICDONE::mark_completes_a_topic( $user_id,  $action_data,  $recipe_id,  $args )

Validation function when the trigger action is hit


Parameters Parameters

$user_id

(Required)

$action_data

(Required)

$recipe_id

(Required)


Source Source

File: src/integrations/learndash/actions/ld-marktopicdone.php

	public function mark_completes_a_topic( $user_id, $action_data, $recipe_id ) {



		$topic_id = $action_data['meta'][ $this->action_meta ];

		//Mark complete a lesson
		$course_id = $action_data['meta']['LDCOURSE'];

		//Mark complete a topic quiz
		$topic_quiz_list = learndash_get_lesson_quiz_list( $topic_id, $user_id, $course_id );
		if ( $topic_quiz_list ) {
			foreach ( $topic_quiz_list as $ql ) {
				$this->quiz_list[ $ql['post']->ID ] = 0;
			}
		}

		$this->mark_quiz_complete( $user_id, $course_id );

		learndash_process_mark_complete( $user_id, $topic_id, false, $course_id );

		Automator()->complete_action( $user_id, $action_data, $recipe_id );
	}