• Resolved tooze

    (@tooze)


    Hi, I updated the Events Calendar plugin this morning from 4.8.2 to 4.9.0. I’m using the Enfold theme, which uses the Avia Layout Builder. When Events Calendar is installed it enables a page builder element called Upcoming Events that only works with this plugin.

    The plugin lists upcoming events in ascending order, and doesn’t show any past events. Since I updated, it is showing in ascending order but includes all past events first, from oldest events to future events.

    I rolled back to 4.8.2 and this fixed it. Is there a new setting in the plugin I must set to hide past events or is this a bug?

    Thanks

Viewing 15 replies - 1 through 15 (of 19 total)
  • I’m noticing this myself with custom queries I’ve written into themes. Seems like this is no longer working with tribe_get_events:

    'events' => 'upcoming'

    Changing over to this seems to fix it:

    'start_date' => date( 'Y-m-d H:i:s' )

    Same problem here but I’m not sure I understand the suggested fix. What I have is a content element with 3 fields : categories of event, number of event to display and pagination y/n. Where am i supposed to apply this fix ?

    Thanks !

    Hi @umanoid, The code snippet in my post is only used if you are placing custom event queries directly into your theme’s template. If you have something within the WordPress Admin that lets you add events, unfortunately that won’t work.

    If you know where the code for that feature is located, you might be able to fix it there. Otherwise, you could try grabbing version 4.8.2 of the plugin and see if that gets things working again.

    Hi Eric !

    Yes, I just reverted back to the previous version and it fixed it. Will now see who’s going to take over from here, the Enfold theme creators or the good people from Modern Tribe.

    Thanks again !

    Francois

    Awesome, glad to hear it worked, @umanoid!

    I can confirm both the problem and solution. I was using 'eventDisplay' => 'upcoming'.

    I’m not sure what other sites I’ve used that code on (though I know it’s a number). Hopefully you can get a fix up soon!

    Hello Friends,

    Below solution is working for us.

    For events starting from now (upcoming):

    'eventDisplay' => 'list',?
    'start_date' => date( 'Y-m-d H:i:s', strtotime( 'now' ) ),

    For events starting from today Start of Day (upcoming):

    'eventDisplay' => 'list',?
    'start_date' => date( 'Y-m-d H:i:s', strtotime( 'today' ) ),

    For Past Events

    'eventDisplay' => 'list',?
    'start_date' => '',

    Thank you.

    • This reply was modified 5 years, 10 months ago by softwebteam.
    • This reply was modified 5 years, 10 months ago by softwebteam.

    I can’t seem to find the original code in any of the tribe-events php files, can you tell me how to add this code via the snippets plugin? I’ve updated this plugin too, it’s Easter and the Events Calendar on our Church website is now showing events from 2018 – this is the worst possible time for us to have this kind of error. Thanks in advance!

    Plugin Author Gustavo Bordoni

    (@bordoni)

    Hi @daniellemolenaar,
    Can you let me know what you mean by the Snippets plugin? Was that something you got from one of our support members?

    As @softwebteam, @mrwweb and @karks88 said, we can use a couple of combinations for tribe_get_events() like the folowing:

    Get events starting after now

    
    tribe_get_events( [
        'start_date' => 'now',
    ] );
    

    Any strtotime() string will work on our date params

    
    tribe_get_events( [
        'start_date' => 'today',
    ] );
    
    // OR
    
    tribe_get_events( [
        'start_date' => 'yesterday',
    ] );
    

    Get only past Events

    
    tribe_get_events( [
        'end_date' => 'now',
    ] );
    

    When we did this update we didn’t imagine that so many customers were still using 'eventDisplay' => 'upcoming' because we had added a deprecation notice since version 3.8. This was our mistake. We are working very hard over this weekend to correct that and push a release to all customers.

    For now, everyone affected by this can either revert to the past version or apply the patches above accordingly.

    We’re very sorry for the issues. Our goal was to make the plugin faster and more reliable with these changes and we apologize for any trouble.

    My Best regards from the Development team.

    This caused a bunch of issues on our end as well. I had no idea that eventDisplay was deprecated, nor that there was any alternative to use. Thanks to the above posters, I’ve found a solution.

    I also found that EventStartDate is no longer working, but event_date seems to work the same way, so that was an easy fix.

    I had the same problem (showing all events, even past events) when I updated the plugin but my tribe_get_events query doesn’t contain 'eventDisplay' => 'upcoming' at all.

    This is the code:

    <?php // Ensure the global $post variable is in scope
    	global $post;
    
    	// Retrieve the next 20 upcoming events
    	$events = tribe_get_events( array(
    		'posts_per_page' => 20,
    		'featured'       => true,
    		'eventDisplay' => 'list'
    	) );
    
    	// The result set may be empty
    	if ( empty( $events ) ) {
    		// echo 'Sorry, nothing found.';
    	}
    	else // Loop through the events: set up each one as
    	// the current post then use template tags to
    	// display the title and content
    	foreach ( $events as $post ) {
    	setup_postdata( $post ); ?>

    @bordoni – Thanks for letting us know and for working on a fix! I think part of the issue was that, as far as I could tell, the removal of 'eventDisplay' => 'upcoming' wasn’t announced in the changelog.

    I run a lot of sites that were built a few years ago and still use this code. If I had known that this update was going to remove it from the plugin, I could have updated those sites beforehand.

    Even if the code is deprecated, it would be great to have a little lead time to know exactly when it will be removed. Obviously, the plugin is amazing and we love it! I think this just comes down to a communication thing.

    Thank you @bordoni & @simonwammerfors.

    The Events Calendar plugin is part of a theme that my client purchased on https://themeforest.net/. I’ve notified the theme developers to fix this, as I am running the newest version of their theme & the Events Plugin.

    Update: I set up a test site and added the code that @simonwammerfors mentioned, but it doesn’t work, site is still showing old events.

    Dear Friends,

    I am using this solution in my WordPress themes and it is working perfect.

    
    $event_type == 'list';
    
    $args = array(
    	'eventDisplay'   => $event_type,
    	'start_date' 	=> ( $event_type == 'list' ) ? 'now' : '',
    	'end_date' 	=> ( $event_type == 'past' ) ? 'now' : '',
    	'order'     	 => ( $event_type == 'list' ) ? 'ASC' : 'DESC',
    	'posts_per_page' => $display_events,
    );
    
    if ( ! empty( $category ) ) {
    	$args['tax_query'] = array(
    		array(
    			'taxonomy'         => TribeEvents::TAXONOMY,
    			'terms'            => $category,
    			'field'            => 'ID',
    			'include_children' => false
    		)
    	);
    }
    
    $posts = tribe_get_events( $args );
    
    
    

    Thank you.

    Thank you @softwebteam. It’s not working for me though :/

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Showing past events first’ is closed to new replies.