/** * Save the metaboxes for this custom post type */ public function save_post($post_id) { // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } // handle the case when the custom post is quick edited // otherwise all custom meta fields are cleared out if (wp_verify_nonce($_POST['_inline_edit'], 'inlineeditnonce')) { return; } if (isset($_POST['post_type']) && $_POST['post_type'] == self::POST_TYPE && current_user_can('edit_post', $post_id)) { Chronosly_Cache::delete_item($post_id); foreach ($this->_meta as $field_name) { // Update the post's meta field update_post_meta($post_id, $field_name, $_POST[$field_name]); } } else { return; } // if($_POST['post_type'] == self::POST_TYPE && current_user_can('edit_post', $post_id)) }
/** * Save the metaboxes for this custom post type */ public function save_post($post_id) { // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } // handle the case when the custom post is quick edited // otherwise all custom meta fields are cleared out if (wp_verify_nonce($_POST['_inline_edit'], 'inlineeditnonce')) { Chronosly_Cache::delete_item($post_id); if (!class_exists("Chronosly_Tickets_and_Repeats_Extended")) { $req = array("ev-to", "ev-to-h", "ev-to-m", "ev-from", "ev-from-h", "ev-from-m", "ev-repeat-every", "ev-repeat", "ev-repeat-option", "ev-until", "ev-end_count", "organizer", "places", "featured", "order"); } else { $req = array("organizer", "places", "featured", "order"); } foreach ($this->_meta as $field_name) { // Update the post's meta field // if($field_name == "tickets"){ // $tick_send = $_POST[$field_name]; // $tickets = @get_post_meta($post_id, 'tickets', true); // $tickets= json_decode($tickets[0]); // if(isset($tickets->tickets)){ // for($i = 1; $i < count($tickets->tickets);++$i){ // $ticket = $tickets->tickets[$i]; // foreach($ticket as $t){ // $tick[$t->name] = $t->value; // if(($t->name == "price" or $t->name == "soldout") and $tick_send[$i][$t->name]) $t->value = $tick_send[$i][$t->name]; // $tickets->tickets[$i][] = array("name" => $t->name, "value" => $t->value); // } // } // update_post_meta($post_id, $field_name, json_encode($tickets)); // } // } // else if (in_array($field_name, $req)) { update_post_meta($post_id, $field_name, $_POST[$field_name]); } } } if (isset($_POST['post_type']) && $_POST['post_type'] == self::POST_TYPE && current_user_can('edit_post', $post_id)) { Chronosly_Cache::delete_item($post_id); foreach ($this->_meta as $field_name) { // Update the post's meta field update_post_meta($post_id, $field_name, $_POST[$field_name]); } } else { return; } // if($_POST['post_type'] == self::POST_TYPE && current_user_can('edit_post', $post_id)) }
public function save_taxonomy_custom_fields($term_id) { $t_id = $term_id; Chronosly_Cache::delete_item($term_id); $metas = array("featured" => $_POST["featured"], "order" => $_POST["order"], "cat-color" => $_POST["cat-color"]); update_option('chronosly-taxonomy_' . $t_id, serialize($metas)); }