LLMS_Quiz_Attempt::delete()
Delete the object from the database
Description Description
Overrides the parent method to perform other actions before deletion.
Return Return
(bool) true on success, false otherwise.
Source Source
File: includes/models/model.llms.quiz.attempt.php
return $this->set( 'questions', serialize( $questions ), $save );
}
/**
* Set the status of the attempt
*
* @since 3.16.0
* @since 4.0.0 Use strict comparisons.
*
* @param string $status Status value.
* @param boolean $save If `true`, immediately persists to database.
* @return false|LLMS_Quiz_Attempt
*/
public function set_status( $status, $save = false ) {
$statuses = array_keys( llms_get_quiz_attempt_statuses() );
if ( ! in_array( $status, $statuses, true ) ) {
return false;
}
return $this->set( 'status', $status );
}
/**
* Record the attempt as started
*
* @since 3.9.0
*
* @return LLMS_Quiz_Attempt Instance of the current quiz attempt object.
*/
public function start() {
$this->set( 'start_date', current_time( 'mysql' ) );
$this->save();
return $this;
}
/**
* Retrieve the private data array
*
* @since 3.9.0
*
* @return array
*/
public function to_array() {
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 4.2.0 | Introduced. |