File: /home/awaldron/_domains/pennhillscdc.org/wp-content/themes/phcdc/page-templates/event_cancel.php
<?php
/**
* Template Name: Event Registration Cancel
*
*/
// Exit if accessed directly.
defined('ABSPATH') || exit;
$path = $_SERVER['REQUEST_URI'];
if (substr($path,-1)=="/") {
$path = substr($path,0,-1);
}
if (substr($path,0,1)=="/") {
$path = substr($path,1);
}
$path = explode('/',$path);
$del_code = $path[1];
// DELETE THE REGISTRATION
if (!empty($del_code)) {
global $wpdb;
$db = new wpdb(APPDB_USER,APPDB_PASSWORD,APPDB_NAME,APPDB_HOST);
$del = "DELETE FROM event_registration WHERE del_code='".$del_code."'";
$db->query($del);
} else {
$del_code = false;
}
get_header();
?>
<div class="sub-image" id="kids">
<div class="container">
<div class="row">
<div class="col-sm-12 text-center"></div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-12">
<h2 class="red header-underline">Event Cancellation</h2>
<div class="text-center" style="font-size:18px;">
<?php if (!$del_code): ?>
<b><i class="fa fas fa-warning red"></i> The URL provided did not include a cancellation code so we couldn't cancel anything!</b>
<p>Thanks for stopping by though!</p>
<br><br>
<p><a href="/upcoming-events" class="btn btn-light btn-pill">View Our Event Listings</a></p>
<?php else: ?>
<b>You have succesfully cancelled your registration for this event.</b>
<p>We're sorry you couldn't make it!</p>
<br><br>
<p><a href="/upcoming-events" class="btn btn-light btn-pill">View Our Event Listings</a></p>
<?php endif; ?>
<br><br>
<br><br>
</div>
</div>
</div>
</div>
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'loop-templates/content', 'empty' );
endwhile;
get_footer();