Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
LF_MARKSECTIONDONE::lf_mark_section_done( string $user_id, array $action_data, string $recipe_id,  $args )

Validation function when the action is hit.


Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Parameters Parameters

$user_id

(Required) user id.

$action_data

(Required) action data.

$recipe_id

(Required) recipe id.


Source Source

File: src/integrations/lifterlms/actions/lf-marksectiondone.php

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

		if ( ! function_exists( 'llms_mark_complete' ) ) {
			$error_message = 'The function llms_mark_complete does not exist';
			Automator()->complete_action( $user_id, $action_data, $recipe_id, $error_message );
			return;
		}
		$section_id = $action_data['meta'][ $this->action_meta ];
		// Get all lessons of section.
		$section = new LLMS_Section( $section_id );
		$lessons = $section->get_lessons();
		if ( ! empty( $lessons ) ) {
			foreach ( $lessons as $lesson ) {
				llms_mark_complete( $user_id, $lesson->id, 'lesson' );
			}
		}
		llms_mark_complete( $user_id, $section_id, 'section' );
		Automator()->complete_action( $user_id, $action_data, $recipe_id );
	}