Event Countdown isn't working. All events shows up as expired (closed)

That's an example.

http://shorturl.staging.wpengine.com/events/2014/06/aubar-thursdays-1/

I'm pulling the event information via php

echo do_shortcode( ' [event_countdown]');

There may be something I'm missing, but it's not working currently.

Cheers.

  • Albert

    Activated Add Ons:

    Next Event
    Event Countdown
    Recurrent Events Redirect
    Weekly Event Calendar
    Import: Facebook Events
    Events Maps Options

    Code that's being used on the custom events page.

    <?php
    
    /**
     * Template Name: Events
    **/
    
    global $blog_id, $wp_query, $booking, $post, $current_user;
    $event = new Eab_EventModel($post);
    
    get_header( );
    ?>
    	<div class="full-width-content">
        	<main class="content" role="main" itemprop="mainContentOfPage">
            	<article class="event page type-page status-publish entry" itemscope="itemscope" itemtype="http://schema.org/CreativeWork">
    
    <?php // echo "status class" . Eab_Template::get_status_class($post); ?>
    <div class="one-third first">
    
    	<?php the_post();
            if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
              the_post_thumbnail("medium");
            }
        ?>
    	<a class="button" href="#guest-list">Put me on the guest list</a>
        <br /><br /><br>
    	<small>Promoter ID:</small>
        <h1 class="entry-title">89</h1>
        <br /><br />
        <?php echo do_shortcode( ' [event_countdown id="1" event_id={$post-ID} format="dHMS" class="countdown-class" type="flip" size="70" add="-120" expired="Closed"]'); ?>
        <?php echo do_shortcode( ' [next_event_countdown]'); ?>
        <?php $meta_values = get_post_meta( get_the_ID() ); ?>
        <br />
        <?php echo "Start : " . $meta_values[incsub_event_start][0]; ?><br />
        <?php echo "End : " . $meta_values[incsub_event_end][0]; ?>
        <br /><br />
        Event ID: <?php echo $post->ID; ?>
    </div>
    
    <div class="two-thirds last">
    	<?php echo "<h1 class=\"entry-title\">" . $event->get_title() . "</h1>"; ?>	
    
    	<?php echo Eab_Template::get_event_details($post); //event_details(); ?>
    
        <div class="event-content">
        	<div class="clear-line"></div>
    		<?php the_content(); ?>
            <?php echo "adicionar informações sobre identidade. Proibido entrada de menor de idade"; ?>
    
    			<?php //print_r( $meta_values ); ?>
                <?php //print_r($event); ?>
    
    	</div>    
    
    </div>
    
    <div class="content">
    <?php // gravity_form(1, false, false, false, '', true, 12); ?>
    	<?php
            add_filter('agm_google_maps-options', 'eab_autoshow_map_off', 99);
            remove_filter('agm_google_maps-options', 'eab_autoshow_map_off');
        ?>
    
        <?php
    		//if ($event->has_venue_map()) {
    		//		echo $event->get_venue_location(Eab_EventModel::VENUE_AS_MAP);
        	//	}
    	?>
    </div>
    
    </article>
    
    </main>
    
    </div></div>
    
    <div class="guest-list-container">
    	<div class="guest-list">
        	<div class="content">
            	<h1 class="entry-title" style="display:block;text-align:center;">Benefits</h1>
                <div class="one-third first">
                	<img src="http://www.dummyimage.com/150x150" /><br />
                    VIP Line Access<br />Don’t wait in line);
                </div>
        		<div class="one-third"><img src="http://www.dummyimage.com/150x150" /><br />No cover</div>
                <div class="one-third last"><img src="http://www.dummyimage.com/150x150" /><br />Get a FREE bottle of Champagne. <a href="#">Click for info</a>.</div>
    
    		</div>
            <div class="clear-line"></div>
        </div>
    </div>
    
    <div class="form-container">
    	<div class="form-wrap">
        	<div class="content">
            <a name="guest-list"></a>
            	<h1 class="entry-title">Get on the Guest List</h1>
            	<?php gravity_form(1, false, false, false, '', true, 12); ?>
            </div>
        </div>
    </div>
    <?php // genesis(); ?>
    <?php get_footer(); ?>
  • Saurabh

    Hi Albert,

    I look at the site here:

    http://shorturl.staging.wpengine.com/events/2014/06/aubar-thursdays-1/

    And there are two countdowns according to your code. The first one isn't getting a post ID. If this is the exact code you are using on your site, then there's an error at about line 29:

    <?php echo do_shortcode( ' [event_countdown id="1" event_id={$post-ID} format="dHMS" class="countdown-class" type="flip" size="70" add="-120" expired="Closed"]'); ?>

    The $post-ID should ideally be $post->ID

    So,
    <?php echo do_shortcode( ' [event_countdown id="1" event_id={$post->ID} format="dHMS" class="countdown-class" type="flip" size="70" add="-120" expired="Closed"]'); ?>

    should fix the countdown.

    Also, using a free IDE (maybe, say Netbeans) that can highlight such errors would be helpful.

    Best

    Saurabh

  • Albert

    Hi Saurabh,

    Yes, you're right. I had though tried hardcoding the post ID as well, and I still haven't been able to get it to work.

    Now, what I have is the following. Made the adjustment you mentioned, but all events are still showing up as closed.

    Cheers

    <?php
    
    /**
     * Template Name: Events
    **/
    
    global $blog_id, $wp_query, $booking, $post, $current_user;
    $event = new Eab_EventModel($post);
    
    get_header( );
    ?>
    	<div class="full-width-content">
        	<main class="content" role="main" itemprop="mainContentOfPage">
            	<article class="event page type-page status-publish entry" itemscope="itemscope" itemtype="http://schema.org/CreativeWork">
    
    <?php // echo "status class" . Eab_Template::get_status_class($post); ?>
    <div class="one-third first">
    
    	<?php the_post();
            if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
              the_post_thumbnail('medium', array('class' => 'event-thumb'));;
            } else {
    			echo "<img class=\"event-thumb\" src=\"http://www.dummyimage.com/302x300\" />";
    		}
        ?>
    	<a class="button" href="#guest-list">Put me on the guest list</a>
        <br /><br /><br>
    	<small>Promoter ID:</small>
        <h1 class="entry-title">89</h1>
        <br /><br />
       <?php echo do_shortcode( ' [event_countdown id="1" event_id={$post->ID} format="dHMS" class="countdown-class" type="flip" size="70" add="-120" expired="Closed"]'); ?>
        <?php echo do_shortcode( ' [next_event_countdown]'); ?>
        <?php $meta_values = get_post_meta( get_the_ID() ); ?>
        <br /><br />
        <?php echo "Start : " . $meta_values[incsub_event_start][0]; ?><br />
        <?php echo "End : " . $meta_values[incsub_event_end][0]; ?>
        <br /><br />
        Event ID: <?php echo $post->ID; ?>
    </div>
    
    <div class="two-thirds last">
    	<?php echo "<h1 class=\"entry-title\">" . $event->get_title() . "</h1>"; ?>	
    
    	<?php echo Eab_Template::get_event_details($post); //event_details(); ?>
    
        <div class="event-content">
        	<div class="clear-line"></div>
    		<?php the_content(); ?>
            <?php echo "adicionar informações sobre identidade. Proibido entrada de menor de idade"; ?>
    
    			<?php //print_r( $meta_values ); ?>
                <?php //print_r($event); ?>
    
    	</div>    
    
    </div>
    
    <div class="content">
    <?php // gravity_form(1, false, false, false, '', true, 12); ?>
    	<?php
            add_filter('agm_google_maps-options', 'eab_autoshow_map_off', 99);
            remove_filter('agm_google_maps-options', 'eab_autoshow_map_off');
        ?>
    
        <?php
    		//if ($event->has_venue_map()) {
    		//		echo $event->get_venue_location(Eab_EventModel::VENUE_AS_MAP);
        	//	}
    	?>
    </div>
    
    </article>
    
    </main>
    
    </div></div>
    
    <div class="guest-list-container">
    	<div class="guest-list">
        	<div class="content">
            	<h1 class="entry-title" style="display:block;text-align:center;">Benefits</h1>
                <div class="one-third first benefits">
                	<img src="http://www.dummyimage.com/150x150" /><br />
                    VIP Line Access<br />Don’t wait in line);
                </div>
        		<div class="one-third benefits"><img src="http://www.dummyimage.com/150x150" /><br />No cover</div>
                <div class="one-third last benefits"><img src="http://www.dummyimage.com/150x150" /><br />Get a FREE bottle of Champagne. <a href="#">Click for info</a>.</div>
    
    		</div>
            <div class="clear-line"></div>
        </div>
    </div>
    
    <div class="form-container">
    	<div class="form-wrap">
        	<div class="content">
            <a name="guest-list"></a>
            	<h1 class="entry-title">Get on the Guest List</h1>
            	<?php gravity_form(1, false, false, false, '', true, 12); ?>
            </div>
        </div>
    </div>
    <?php // genesis(); ?>
    <?php get_footer(); ?>
  • Saurabh

    Hi Albert,

    I'm not sure why (I'm pretty curious myself and will explore), but the code doesn't work with

    event_id={$post->ID}

    but does work with

    event_id='.$post->ID.'

    I couldn't recreate any other error. I tried using the event ID directly and it did work.

    If this does fix things for you, let me know. Otherwise, I will need to have a closer look at your site:

    Can you please send me your login details via our secure contact form

    1: Mark the email to my attention

    Attn: Saurabh

    2: Include a link of this thread in the email

    3: Include FTP and WordPress super admin details.

    4: While filling the form, select "I have a different question" from the list.

    Best

    Saurabh

  • Saurabh

    Hi Albert,

    Looks like the Countdown addons didn't play well with recurring events. It is a bug and we'll fix it in the next release, asap.

    Just so that this is clear and anyone else is looking at a similar scenario, I'll mention the problem and the solution here. Recurring events use custom post statuses. The sql query for the countdown addons includes a condition that checks for the publish status, that is never set on recurring events and hence, it doesn't get a matching event and assumes that it is expired.

    I have removed this condition from your install, from plugins/events-and-bookings/lib/plugins/eab-events-event-countdown.php at about line 198:

    AND wposts.post_type='incsub_event' AND wposts.post_status='publish'

    to
    AND wposts.post_type='incsub_event'

    I have fixed it in your install. In the next update or so, this should be permanently fixed.

    Do let us know if you need any further assistance with this.

    Best

    Saurabh