Support

Home Forums Event Espresso Premium Expired Events Showing after Version Upgrades

Expired Events Showing after Version Upgrades

Posted: July 25, 2017 at 8:34 am

Viewing 5 reply threads


Adam Curry

July 25, 2017 at 8:34 am

We are running Version 4.9.44.p

After upgrading to this version, our expired events are now showing in our custom event lists (they didn’t used to). I don’t know which version change created this, but I know it was working correctly on Version 4.9.7.p.

I can’t find changes relating to this in the Changelog, so I must have missed something.

Here is the code, which is based on this page (https://gist.github.com/joshfeck/e3c9540cd4ccc734e755):

<?php
$attsNextThreeEvents = array(
'title' => NULL,
'limit' => 3,
'css_class' => NULL,
'show_expired' => FALSE,
'month' => NULL,
'category_slug' => NULL,
'order_by' => 'start_date',
'sort' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'city',
'field'    => 'term_id',
'terms'    => array( $ucUserGroupCity->term_id ),
)
)
);
global $wp_query;
$wp_query = new EE_Event_List_Query( $attsNextThreeEvents );
if (have_posts()) : while (have_posts()) : the_post();
echo '<p><a href="' . get_the_permalink() . '"><span>' . get_the_title() . '</span></a></p>';
endwhile;
else:
echo '<p>No upcoming meetups</p>';
endif;
wp_reset_query();
wp_reset_postdata();
?>

Here is the page where you can see this historic expired meetups showing in the upcoming list:
http://www.skypeug.com/meetups/

And here is a staging site copy that is running Version 4.9.7.p. And you’ll notice that no expired events are showing. (There are no upcoming on that site, so nothing is showing).
http://ucusergroup.staging.wpengine.com/meetups/

One of the most recently changelogs indicated that EE_Event_List_Query is deprecated, but I did not see a replacement indicated. Please inform of the way to properly accomplish our code in the new version.


Josh

  • Support Staff

July 25, 2017 at 9:36 am

Hi Adam,

You can change this:
$wp_query = new EE_Event_List_Query( $attsNextThreeEvents );
to be this:
$wp_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery( $attsNextThreeEvents );

and that should fix things for you.


Adam Curry

July 26, 2017 at 8:10 am

That corrected the expired events issue, but with that code, the taxonomy query no longer worked.

How can I get both the expired events filter and the taxonomy query working at the same time like it was before?


Josh

  • Support Staff

July 26, 2017 at 10:42 am

Event Espresso 4.9.45 is released and includes a fix for the stripped query args. It is available as a 1-click update from your WP Dashboard’s Plugins page. You can trigger an update notice (if you don’t see one yet) by going to the Event Espresso > General Settings page then click on Save.


Adam Curry

July 27, 2017 at 5:15 am

Wonderful – that worked. Thank you! I upgraded to Event Espresso 4.9.45, and implemented your code above, and it’s all working properly again.

Out of curiosity, why is EE_Event_List_Query being removed? Having access to that is almost critical to EE development.


Josh

  • Support Staff

July 27, 2017 at 10:36 am

EE_Event_List_Query was deprecated in favor of EventEspresso\core\domain\services\wp_queries\EventListQuery. The Event Espresso 4 codebase is gradually converting over to PSR-4 Autoloading. You can actually use the standard WP_Query class to pull in events in the same manner as the EventListQuery class, the difference being there are a few conveniences with the latter.

Viewing 5 reply threads

The support post ‘Expired Events Showing after Version Upgrades’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso