public/wordpress/wp-content/plugins/wp-courseware/includes/models/unit.php
/**
	 * Disconnect Unit.
	 *
	 * This will make the quiz disconnected from any module
	 * and disassociate any quizzes.
	 *
	 * @since 4.4.0
	 *
	 * @return bool True if it is successfully unassociated.
	 */
Disconnect Unit.
This will make the quiz disconnected from any module
and disassociate any quizzes.



@return bool True if it is successfully unassociated.
Disconnect Unit . This will make the quiz disconnected from any module and disassociate any quizzes . @return bool True if it is successfully unassociated .
public function disconnect() {
		global $wpdb, $wpcwdb;
		$this->set_prop( 'unit_order', 0 );
		$this->set_prop( 'unit_number', 0 );
		$this->set_prop( 'parent_module_id', 0 );
		$this->set_prop( 'parent_course_id', 0 );
		$this->delete_meta( 'wpcw_associated_module' );
		$wpdb->query( $wpdb->prepare(
			"DELETE FROM $wpcwdb->user_progress 
			 WHERE unit_id = %d",
			$this->get_id()
		) );
		$wpdb->query( $wpdb->prepare(
			"UPDATE $wpcwdb->quiz 
			 SET parent_unit_id = %d, parent_course_id = %d 
			 WHERE parent_unit_id = %d",
			0, 0, $this->get_id()
		) );
		WPCW_queue_dripfeed::updateQueueItems_unitRemovedFromCourse( $this->get_id() );
		$this->save();
	}
public function disconnect ( ) { global $ wpdb , $ wpcwdb ; $ this -> set_prop ( 'unit_order' , 0 ) ; $ this -> set_prop ( 'unit_number' , 0 ) ; $ this -> set_prop ( 'parent_module_id' , 0 ) ; $ this -> set_prop ( 'parent_course_id' , 0 ) ; $ this -> delete_meta ( 'wpcw_associated_module' ) ; $ wpdb -> query ( $ wpdb -> prepare ( " DELETE FROM  $ wpcwdb -> user_progress  
			 WHERE unit_id = %d " , $ this -> get_id ( ) ) ) ; $ wpdb -> query ( $ wpdb -> prepare ( " UPDATE  $ wpcwdb -> quiz  
			 SET parent_unit_id = %d, parent_course_id = %d 
			 WHERE parent_unit_id = %d " , 0 , 0 , $ this -> get_id ( ) ) ) ; WPCW_queue_dripfeed :: updateQueueItems_unitRemovedFromCourse ( $ this -> get_id ( ) ) ; $ this -> save ( ) ; }
Disconnect Unit.
Disconnect Unit .
// Set Properties. // Delete Module Meta. // Delete from user progress. // Unconnect it from the quiz that it's associated with. // Update Queue Items. // Save Unit.