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
TUTORLMS_QUIZFAILED::failed( $attempt_id )
Validates Trigger.
Contents
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
- $attempt_id
(Required) Post ID of the attempt
Source Source
File: src/integrations/tutorlms/triggers/tutorlms-quizfailed.php
public function failed( $attempt_id ) { // get the quiz attempt. $attempt = tutor_utils()->get_attempt( $attempt_id ); // Bail if this not the registered quiz post type if ( 'tutor_quiz' !== get_post_type( $attempt->quiz_id ) ) { return; } // bail if the attempt isn't finished yet. if ( 'attempt_ended' !== $attempt->attempt_status ) { return; } // bail if they have passed. if ( Automator()->helpers->recipe->tutorlms->options->was_quiz_attempt_successful( $attempt ) ) { return; } // current user. $user_id = get_current_user_id(); // trigger entry args. $args = [ 'code' => $this->trigger_code, 'meta' => $this->trigger_meta, 'post_id' => $attempt->quiz_id, 'user_id' => $user_id, ]; // run trigger. Automator()->maybe_add_trigger_entry( $args, true ); }
Expand full source code Collapse full source code View on Github
Changelog Changelog
Version | Description |
---|---|
2.4.0 | Introduced. |