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
Description Description
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. |
User Contributed Notes User Contributed Notes
Permalink: