} if ($variable == 'verif' || $variable == 'notverif') { if (strlen(get_post_meta($post_id, variable, true)) > 0) { $value = htmlspecialchars(get_post_meta($id_post, $variable, true)); } else { $value = '0'; } update_post_meta($id_post, $variable, $value); } if (isset($_POST[$variable])) { $value = htmlspecialchars($_POST[$variable]); update_post_meta($id_post, $variable, $value); } } update_post_meta($id_post, 'count', '0'); update_post_meta($id_post, 'location', localiser_ville()); // on redirige vers la page aide. header('Location:http://ndi.witip.solutions/index.php/catastrophes-en-cours/ '); } ?> <?php get_header(); ?> <div class="container page-container"> <div id="content" role="main"> <form method="post"> <div class="row"> <div class="col-sm-2"> <i class="fa fa-map-marker"></i>
function ihelp_extra_details_save() { // sauvegarder la possibilité d'aider. $title = $_POST['details_contact']; $post = array('post_content' => '', 'post_title' => $title, 'post_status' => 'publish', 'post_type' => 'offre_aide'); $post_id = wp_insert_post($post); $ip = $_SERVER['REMOTE_ADDR']; update_post_meta($post_id, 'ip', $ip); update_post_meta($post_id, 'localisation', localiser_ville()); if ($post_id) { echo '<div class="alert alert-success" role="alert">Merci pour votre aide !</div>'; } global $wpdb; $searchresults = $wpdb->get_results("\n SELECT * \n FROM `wp_posts` \n WHERE `post_type`=\"offre_aide\"\n "); echo '<h2>Les personnes suivantes sont en détresse :<br /><br />'; // afficher la liste des personnes en recherche d'aide autour. echo '<ul class="list-group">'; // on liste les demandes d'aide if ($searchresults) { foreach ($searchresults as $post) { echo '<li class="list-group-item">' . substr($post->post_title, 0, 3) . '...</li>'; } } echo '</ul>'; }