LLMS_Question_Manager::update_question( array $data = array() )
Create or update questions If ‘id’ passed in $data array will update existing question Omit ‘id’ to create a new question
Parameters Parameters
- $data
-
(array) (Optional) array of question data
Default value: array()
Return Return
(false|question) id
Source Source
File: includes/class.llms.question.manager.php
public function update_question( $data = array() ) { // If there's no ID, we'll add a new question. if ( ! isset( $data['id'] ) ) { return $this->create_question( $data ); } // Get the question. $question = $this->get_question( $data['id'] ); if ( ! $question ) { return false; } // Update all submitted data. foreach ( $data as $key => $val ) { // Merge image data into the array. if ( 'image' === $key ) { $val = array_merge( array( 'enabled' => 'no', 'id' => '', 'src' => '', ), $question->get( $key ), $val ); } $question->set( $key, $val ); } // Return question ID. return $question->get( 'id' ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.16.0 | Introduced. |