public function saveOccasions()
    {
        global $wpdb;

        // Delete all occasions related to the event
        $db_table = $wpdb->prefix."integrate_occasions";
        $wpdb->delete($db_table, array('event_id' => $this->ID), array('%d'));

        // Remove post if occasions is missing
        if ($this->occasions_complete == null || empty($this->occasions_complete)) {
            wp_delete_post($this->ID, true);

            return false;
        }

        // Loop through occasions for the event
        foreach ($this->occasions_complete as $o) {
            $start_date = !empty($o['start_date']) ? $o['start_date'] : null;
            $end_date = !empty($o['end_date']) ? $o['end_date'] : null;
            $door_time = !empty($o['door_time']) ? $o['door_time'] : null;
            $status = !empty($o['status']) ? $o['status'] : null;
            $occ_exeption_information = !empty($o['occ_exeption_information']) ? $o['occ_exeption_information'] : null;
            $content_mode = !empty($o['content_mode']) ? $o['content_mode'] : null;
            $content = !empty($o['content']) ? $o['content'] : null;

            $wpdb->insert(
                $db_table,
                array(
                    'event_id' => $this->ID,
                    'start_date' => $start_date,
                    'end_date' => $end_date,
                    'door_time' => $door_time,
                    'status' => $status,
                    'exception_information' => $occ_exeption_information,
                    'content_mode' => $content_mode,
                    'content' => ($content),
                )
            );
        }

        return true;
    }
public function saveOccasions()
    {
        global $wpdb;

        // Delete all occasions related to the event
        $db_table = $wpdb->prefix."integrate_occasions";
        $wpdb->delete($db_table, array('event_id' => $this->ID), array('%d'));

        // Remove post if occasions is missing
        if ($this->occasions_complete == null || empty($this->occasions_complete)) {
            wp_delete_post($this->ID, true);

            return false;
        }

        // Loop through occasions for the event
        foreach ($this->occasions_complete as $o) {
            $start_date = !empty($o['start_date']) ? $o['start_date'] : null;
            $end_date = !empty($o['end_date']) ? $o['end_date'] : null;
            $door_time = !empty($o['door_time']) ? $o['door_time'] : null;
            $status = !empty($o['status']) ? $o['status'] : null;
            $occ_exeption_information = !empty($o['occ_exeption_information']) ? $o['occ_exeption_information'] : null;
            $content_mode = !empty($o['content_mode']) ? $o['content_mode'] : null;
            $content = !empty($o['content']) ? $o['content'] : null;

            $wpdb->insert(
                $db_table,
                array(
                    'event_id' => $this->ID,
                    'start_date' => $start_date,
                    'end_date' => $end_date,
                    'door_time' => $door_time,
                    'status' => $status,
                    'exception_information' => $occ_exeption_information,
                    'content_mode' => $content_mode,
                    'content' => ($content),
                )
            );
        }

        return true;
    }
public function saveOccasions ( ) { global $ wpdb ; // Delete all occasions related to the event $ db_table = $ wpdb -> prefix . "integrate_occasions" ; $ wpdb -> delete ( $ db_table , array ( 'event_id' => $ this -> ID ) , array ( '%d' ) ) ; // Remove post if occasions is missing if ( $ this -> occasions_complete == null || empty ( $ this -> occasions_complete ) ) { wp_delete_post ( $ this -> ID , true ) ; return false ; } // Loop through occasions for the event foreach ( $ this -> occasions_complete as $ o ) { $ start_date = ! empty ( $ o [ 'start_date' ] ) ? $ o [ 'start_date' ] : null ; $ end_date = ! empty ( $ o [ 'end_date' ] ) ? $ o [ 'end_date' ] : null ; $ door_time = ! empty ( $ o [ 'door_time' ] ) ? $ o [ 'door_time' ] : null ; $ status = ! empty ( $ o [ 'status' ] ) ? $ o [ 'status' ] : null ; $ occ_exeption_information = ! empty ( $ o [ 'occ_exeption_information' ] ) ? $ o [ 'occ_exeption_information' ] : null ; $ content_mode = ! empty ( $ o [ 'content_mode' ] ) ? $ o [ 'content_mode' ] : null ; $ content = ! empty ( $ o [ 'content' ] ) ? $ o [ 'content' ] : null ; $ wpdb -> insert ( $ db_table , array ( 'event_id' => $ this -> ID , 'start_date' => $ start_date , 'end_date' => $ end_date , 'door_time' => $ door_time , 'status' => $ status , 'exception_information' => $ occ_exeption_information , 'content_mode' => $ content_mode , 'content' => ( $ content ) , ) ) ; } return true ; }
Save event occasions to integrate_occasions table
@return boolean true if one or more occasions was saved, false if not.
Save event occasions to integrate_occasions table