public/wordpress/wp-content/plugins/wp-courseware/includes/models/unit.php
/**
	 * Delete Unit.
	 *
	 * @since 4.4.0
	 *
	 * @return bool True upon successful deletion. False otherwise.
	 */
Delete Unit.

@return bool True upon successful deletion. False otherwise.
Delete Unit . @return bool True upon successful deletion . False otherwise .
public function delete() {
		global $wpdb, $wpcwdb;
		$unit_deleted = $this->db->delete( $this->get_id() );
		if ( $unit_deleted ) {
			wp_delete_post( $this->get_id(), true );
			$parent_course_id = $this->get_parent_course_id();
			if ( $parent_course_id > 0 ) {
				WPCW_courses_reorderUnitNumbers( $parent_course_id );
				$course = wpcw_get_course( $parent_course_id );
				do_action( 'wpcw_course_details_updated', $course );
			}
			$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() ) );
			$wpdb->query( $wpdb->prepare( "UPDATE $wpcwdb->user_progress_quiz SET unit_id = %d WHERE unit_id = %d", 0, $this->get_id() ) );
			WPCW_queue_dripfeed::updateQueueItems_unitDeleted( $this->get_id() );
		}
		return $deleted;
	}
public function delete ( ) { global $ wpdb , $ wpcwdb ; $ unit_deleted = $ this -> db -> delete ( $ this -> get_id ( ) ) ; if ( $ unit_deleted ) { wp_delete_post ( $ this -> get_id ( ) , true ) ; $ parent_course_id = $ this -> get_parent_course_id ( ) ; if ( $ parent_course_id > 0 ) { WPCW_courses_reorderUnitNumbers ( $ parent_course_id ) ; $ course = wpcw_get_course ( $ parent_course_id ) ; do_action ( 'wpcw_course_details_updated' , $ course ) ; } $ 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 ( ) ) ) ; $ wpdb -> query ( $ wpdb -> prepare ( " UPDATE  $ wpcwdb -> user_progress_quiz  SET unit_id = %d WHERE unit_id = %d " , 0 , $ this -> get_id ( ) ) ) ; WPCW_queue_dripfeed :: updateQueueItems_unitDeleted ( $ this -> get_id ( ) ) ; } return $ deleted ; }
Delete Unit.
Delete Unit .
// Delete Post. // Parent Course Id. // Ony run if parent course id exists. // Re-Order Unit Numbers. // Get Course Details. /**
				 * Action: Course Details Updated.
				 *
				 * @since 4.4.0
				 */ // Delete User Progress. // Disconnnect Quiz. // Remove Quiz Progress. // Update Queue Items.