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
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | 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. |