public function save_meta_boxes($post_id) { global $post_type, $wpdb; $session = new session(); if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) { return false; } if ($post_type !== 'syn_rest_reservation') { return false; } $first_name = $session->post_var('first_name'); $last_name = $session->post_var('last_name'); $phone_number = $session->post_var('phone_number'); $email_address = $session->post_var('email_address'); $guests_count = $session->post_var('guests_count'); $reservation_date = $session->post_var('reservation_date'); $reservation_time = $session->post_var('reservation_time'); update_post_meta($post_id, 'first_name', $first_name); update_post_meta($post_id, 'last_name', $last_name); update_post_meta($post_id, 'phone_number', $phone_number); update_post_meta($post_id, 'email_address', $email_address); update_post_meta($post_id, 'guests_count', $guests_count); update_post_meta($post_id, 'reservation_date', $reservation_date); update_post_meta($post_id, 'reservation_time', $reservation_time); $arrival_time = date('Y-m-d H:i:s', strtotime("{$reservation_date}, {$reservation_time}")); update_post_meta($post_id, 'arrival_time', $arrival_time); $title = 'Reservation: ' . $first_name . ' ' . $last_name; $where = array('ID' => $post_id); $wpdb->update($wpdb->posts, array('post_title' => $title), $where); }
/** * Saves the metaboxes * @global type $post_type * @param type $post_id * @return boolean */ public function save_meta_boxes($post_id) { global $post_type; $session = new session(); if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) { return false; } if ($post_type !== 'syn_rest_meal') { return false; } $full_price = $session->post_var('full_price'); $small_plate_price = $session->post_var('small_plate_price'); $display_price = $session->post_var('display_price', 'off'); $calorie_count = $session->post_var('calorie_count'); $new_addition = $session->post_var('new_addition'); $healthy_option = $session->post_var('healthy_option'); $gluten_free = $session->post_var('gluten_free'); $spice_rating = $session->post_var('spice_rating'); update_post_meta($post_id, 'full_price', $full_price); update_post_meta($post_id, 'small_plate_price', $small_plate_price); update_post_meta($post_id, 'display_price', $display_price); update_post_meta($post_id, 'calorie_count', $calorie_count); update_post_meta($post_id, 'new_addition', $new_addition); update_post_meta($post_id, 'healthy_option', $healthy_option); update_post_meta($post_id, 'gluten_free', $gluten_free); update_post_meta($post_id, 'spice_rating', $spice_rating); }
public function process_status($post_id) { global $post_type; $session = new session(); if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) { return false; } if ($post_type !== 'syn_rest_reservation') { return false; } $event_log = new event_log(); $old_post_status = $session->post_var('original_post_status'); $post = get_post($post_id); $post_status = $post->post_status; $email_address = get_post_meta($post_id, 'email_address', true); //check if the post status has changed if ($post_status !== $old_post_status) { $result = syntaxthemes_process_notification_email($post_status, $email_address, $post_id); $event_log->status_event($post_id, $old_post_status, $post_status, $result); } }