<?php get_header(); ?>
<section id="content" role="main" class='col-12'>
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

      <section class="entry-content">

        <?php
        //pull in varibles from url and add to page
        //debug(wp_get_current_user());
        if(isset($_GET['co'])) {
          $course = $_GET['co'];
          $email = $_GET['em'];
          $firstName = $_GET['fn'];
          $lastName = $_GET['ln'];
        }
        ?>

        <!--  //remove permission if loogged in -->
        <?php  if(is_user_logged_in() && isset($_GET['co']) && isset($_GET['em']) && isset($_GET['fn']) && isset($_GET['ln']) ):?>

          <?php $user = wp_get_current_user();?>
          <div>
            <header class="header">
              <img class='print-logo' src="/wp-content/themes/varn/assets/src/img/index.gif">
              <h1 class="entry-title"><?php the_title(); ?></h1>
            </header>
            <?php the_content(); ?>
            <h2>Congratulations <?php echo ucfirst($firstName); ?> <?php echo ucfirst($lastName); ?></h2>
            <h3>Email address:  <?php echo $email; ?></h3></br>
            <h3>You passed the <?php echo $course; ?> test on <?php echo date("d/m/Y"); ?> great work!</h3>

            <a href="javascript:window.print()" id='printing-button'><i class="fa fa-print" aria-hidden="true"></i><span>Print this page</span></a>
          </div>

        <?php else:?>

          <h2>Sorry you do not have permission to view this page</h2>
        <?php endif;?>

        <a class='return-button' href='gls-webinars'>Back to webinars page</a>

        <div class="entry-links"><?php wp_link_pages(); ?></div>
      </section>
    </article>
  <?php endwhile; endif; ?>
</section>

<?php get_footer(); ?>
