/** * Save the meta when the post is saved. * * @param int $post_id The ID of the post being saved. */ public function save($post_id) { // If this is an autosave, our form has not been submitted, // so we don't want to do anything. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } // Check the user's permissions. if ('page' == $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) { return $post_id; } } else { if (!current_user_can('edit_post', $post_id)) { return $post_id; } } if ($post_id != null) { $this->evento = Eventos::getInstance()->getById($post_id); } /* OK, its safe for us to save the data now. */ meta_update($post_id, 'id_evento_pai'); meta_update($post_id, 'descricao_1', false); // Descricao2 meta_update($post_id, 'descricao_2', false); // Descricao3 meta_update($post_id, 'descricao_3', false); // Publico Alvo meta_update($post_id, 'publico_alvo'); // Instrutor meta_update($post_id, 'id_instrutor', false); // Local meta_update($post_id, 'id_local', false); // Organizador if (get_option('singleOrganizer', true) && get_option('idSingleOrganizer', null) != null) { update_post_meta($post_id, 'id_organizador', get_option('idSingleOrganizer')); } else { meta_update($post_id, 'id_organizador', false); } // Topicos meta_update($post_id, 'topicos', false); // FAQ meta_update($post_id, 'faq', false); // Data meta_update($post_id, 'data'); // Hora meta_update($post_id, 'hora'); // Data meta_update($post_id, 'data_fim'); // Hora meta_update($post_id, 'hora_fim'); // dataInicioInscricoes meta_update($post_id, 'data_inicio_inscricoes'); // data_fimInscricoes meta_update($post_id, 'data_fim_inscricoes'); // vagas meta_update($post_id, 'vagas'); // pago meta_update($post_id, 'pago'); meta_update($post_id, 'pago_dinheiro'); meta_update($post_id, 'pago_pagseguro'); meta_update($post_id, 'pago_cielo'); meta_update($post_id, 'pago_deposito'); meta_update($post_id, 'fb_conversion_track'); // Integração de Pagamento meta_update($post_id, 'id_integracao_pagseguro', false); meta_update($post_id, 'id_integracao_cielo', false); // Local pagamento meta_update($post_id, 'id_local_pagamento', false); // Fila de espera meta_update($post_id, 'fila_espera'); // beta meta_update($post_id, 'beta'); // Campos extras meta_update($post_id, 'campos_extras', false); // Id Questionário meta_update($post_id, 'id_questionario', false); // Duração meta_update($post_id, 'duracao'); meta_update($post_id, 'horarios'); meta_update($post_id, 'requisitos'); // Valor meta_update($post_id, 'valor'); // Material Didático meta_update($post_id, 'material'); // Certificado meta_update($post_id, 'certificado'); // confirmacao meta_update($post_id, 'confirmacao'); // validacaoPessoa meta_update($post_id, 'validacao_pessoa', false, 'email'); //die(); // Release meta_update($post_id, 'release', false); // Campos extras meta_update($post_id, 'secoes_extras', false); // Cada seção if ($this->evento) { $secoes = $this->evento->getSecoesExtras(); if ($secoes != null) { foreach ($secoes as $secao => $titulo) { meta_update($post_id, 'secao_' . $secao, false); } } } // Mensagens if ($post_id) { Mensagens::getInstance()->savePost($_POST); } // echo "<br>FIM DE POSTANDO<br>"; }
/** * Save the meta when the post is saved. * * @param int $post_id The ID of the post being saved. */ public function save($post_id) { // If this is an autosave, our form has not been submitted, // so we don't want to do anything. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } /* Ok ok, vamos salvar agora */ // Titulo meta_update($post_id, 'id_local'); meta_update($post_id, 'vagas'); meta_update($post_id, 'pago'); meta_update($post_id, 'data_fim'); meta_update($post_id, 'data_inicio_inscricoes'); meta_update($post_id, 'data_fim_inscricoes'); meta_update($post_id, 'descricao_1'); meta_update($post_id, 'descricao_2'); meta_update($post_id, 'descricao_3'); meta_update($post_id, 'publico_alvo'); meta_update($post_id, 'material'); meta_update($post_id, 'certificado'); meta_update($post_id, 'id_instrutor'); meta_update($post_id, 'duracao'); meta_update($post_id, 'topicos'); meta_update($post_id, 'faq'); meta_update($post_id, 'beta'); meta_update($post_id, 'confirmacao'); meta_update($post_id, 'validacao_pessoa'); meta_update($post_id, 'campos_extras'); meta_update($post_id, 'secoes_extras'); // valores padrão meta_update($post_id, 'valor_id_organizador'); meta_update($post_id, 'valor_confirmacao'); meta_update($post_id, 'valor_pago'); }
public function insert(&$obj) { // Incluir post do evento /* @var $wpdb wpdb */ $values = array('post_title' => $obj->titulo, 'post_status' => 'publish', 'post_type' => 'tgo_evento', 'post_date' => 'current_timestamp', 'post_date_gmt' => 'current_timestamp'); $filter = function_exists('wp_db_null_value') ? 'wp_db_null_value' : 'DB::wpDbNullValue'; add_filter('query', $filter); $ok = $this->wpdb()->insert($this->tableName, $values); if ($ok === false) { throw new \Exception($this->wpdb()->last_error); } $id = $this->wpdb()->insert_id; remove_filter('query', $filter); $evento = $this->getById($id); // Obter permalink get_sample_permalink($id, $evento->titulo); $post_id = $id; // Descricao2 meta_update($post_id, 'descricao_2', false); meta_update($post_id, 'descricao_3', false); // Publico Alvo meta_update($post_id, 'publico_alvo'); // Local meta_update($post_id, 'id_local', false); // Organizador if (get_option('singleOrganizer', true) && get_option('idSingleOrganizer', null) != null) { update_post_meta($post_id, 'id_organizador', get_option('idSingleOrganizer')); } else { meta_update($post_id, 'id_organizador', false); } meta_update($post_id, 'data'); meta_update($post_id, 'hora'); meta_update($post_id, 'data_fim'); meta_update($post_id, 'hora_fim'); meta_update($post_id, 'vagas'); meta_update($post_id, 'pago'); meta_update($post_id, 'valor'); return $this->getById($id); }
function meta_replace($table, $parent_id, $meta_name, $meta_value) { $id = meta_get_id($table, $parent_id, $meta_name); if (!$id) { meta_insert($table, $parent_id, $meta_name, $meta_value); } else { meta_update($table, $id, $meta_value); } }
private static function editAreaAluno($evento) { if ($_POST) { meta_update($evento->id, 'area_aluno', false); require_once PLUGINPATH . '/view/eventos/view_area_aluno.php'; } else { require_once PLUGINPATH . '/view/eventos/form_area_aluno.php'; } }