Support

Home Forums Event Espresso Premium Show Expired = False Not working in EE4

Show Expired = False Not working in EE4

Posted: June 1, 2022 at 3:00 pm

Viewing 13 reply threads


scaldwell

June 1, 2022 at 3:00 pm

I’m using this shortcode:
[ESPRESSO_EVENTS category_slug=class order_by=start_date,id button_text=’More Info’ show_expired=false]

What am I doing wrong here? Thank you!

Page: https://hoffmanarts.org/classes/all-classes/


Tony

  • Support Staff

June 2, 2022 at 7:17 am

Hi Shelly,

May I ask which events you expect not to be visible on that page, please?

I suspect what EE defines as expired is different from what you are expecting here.

For example I’m assuming you are expecting this event:

https://hoffmanarts.org/events/summer-poetry-kickstart/

To be removed because the ticket has expired? If so, it’s not what EE considers an expired event as it has Datetimes on the event that are upcoming.

Apologies if I’m way off the mark here but if so if you can add some more details I’ll check into those events and confirm 🙂


scaldwell

June 2, 2022 at 9:48 am

You are totally correct…. they want to be able to hide it because you can no longer buy tickets. Is there some other way to achieve this?Thank you so much,S


Joao Victor

  • Support Staff

June 3, 2022 at 8:54 pm

Hi there!

Thanks for getting back to us.
Could you share a screenshot of where the Expired event is displayed on your page? I tested your shortcode on my local environment and it worked fine.

Thanks,


scaldwell

June 6, 2022 at 5:49 pm

We are using this shortcode:

[ESPRESSO_EVENTS category_slug=class order_by=start_date,id button_text=’More Info’ show_expired=false]

On this page:

https://hoffmanarts.org/classes/all-classes/

The Moon Journal is now Sold out and still showing and the Summer Poetry no longer has tickets on sale (but there are class dates that are yet to happen). Ideally neither of these should be showing…

I’ve added the following to our functions.php:

function tw_ee_tweak_event_list_exclude_sold_out_events_where( $SQL, WP_Query $wp_query ) {
if ( isset( $wp_query->query_vars[‘post_type’] ) && ( $wp_query->query_vars[‘post_type’] == ‘espresso_events’ || ( is_array( $wp_query->query_vars[‘post_type’] ) && in_array( ‘espresso_events’, $wp_query->query_vars[‘post_type’] ) ) ) && ! $wp_query->is_singular ) {
global $wpdb;

$SQL .= “AND {$wpdb->prefix}posts.post_status != ‘sold_out’ “;
}
return $SQL;
}
add_filter( ‘posts_where’, ‘tw_ee_tweak_event_list_exclude_sold_out_events_where’, 15, 2 );

// removes sold events from displaying in the Upcoming Events widget

add_filter(
‘FHEE__EEW_Upcoming_Events__widget__where’,
‘jf_ee_remove_sold_out_events_from_widget’,
10,
3
);
function jf_ee_remove_sold_out_events_from_widget($where, $category, $show_expired){
$where[‘status’] = array(‘IN’, array(‘publish’));
return $where;
}


Joao Victor

  • Support Staff

June 6, 2022 at 8:52 pm

Hi there!

Thanks for getting back to me.

Actually, I think I know what is happening here. For Event Espresso, the expired means “the end date to sell tickets is reached”; the expired event is not when the tickets are sold out, for this reason, you are still viewing the “expired” tickets. With the above code, is it worked as expected?


scaldwell

June 6, 2022 at 9:23 pm

Is it at all possible to hide events once there are no tickets left? OR is there a way to have a banner or notice that says “Sold Out” on the event list?


Tony

  • Support Staff

June 6, 2022 at 11:30 pm

There is a snippet to exclude events that have only expired tickets available here:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/templates/de_ee_filter_events_out_with_expired_tickets.php

However, can you add a screenshot of the Datetime & Tickets section for the Moon Journal event? As far as I can tell that should be switching status to Sold out and be removed by the other snippet.


scaldwell

June 8, 2022 at 12:22 pm

Yes you can see it here; https://hoffmanarts.org/events/moon_journal_series_1-with-melissa-young/


Tony

  • Support Staff

June 8, 2022 at 12:39 pm

Can you edit that event and post a screenshot of the ‘Event Tickets & Datetimes’ section, please?

https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots

From what I can see on the front end, that event should have switched to Sold Out, but it hasn’t, just the ticket has.


scaldwell

June 8, 2022 at 12:58 pm

whoops. sorry: https://ibb.co/478K9KN


Tony

  • Support Staff

June 8, 2022 at 4:30 pm

Hmm, something isn’t adding up here.

Are you sure thats the correct event you edited? (Sorry to ask, but the image just doesn’t add up)

The ticket in that screenshot is Active, not sold out (it has a qty of 16 and 8 sold)

The datetimes displayed in that image don’t match up with the datetime displayed on the event you linked to.

So to confirm, I’m looking at this event:

https://hoffmanarts.org/events/moon_journal_series_1-with-melissa-young/

And want the same section above in the screenshot, but for that event, is that what was added above?


scaldwell

June 9, 2022 at 8:41 am

Ok – this is definitely it:
https://ibb.co/f1LB54J


Tony

  • Support Staff

June 9, 2022 at 3:45 pm

Hmm, yeah that one really doesn’t make sense! That event is sold out and should be switching to sold out.

Mind if I take a look in the admin to see if anything stands out on that event?

Viewing 13 reply threads

The support post ‘Show Expired = False Not working in EE4’ 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