Support

Home Forums Event Espresso Premium Remove expired events from website view

Remove expired events from website view

Posted: May 29, 2020 at 12:40 pm


Softwired

May 29, 2020 at 12:40 pm

We’ve had an ongoing issue with displaying events that have expired. The issue was are having is we are using WP Bakery post grid to display events. There doesn’t seem to be a page element that has a filter for event status.

I’m searching for a solution the works for the client so they don’t have to keep going in and publishing manually once an event has expired.

Thank you


Softwired

May 29, 2020 at 12:40 pm

following


Tony

  • Support Staff

June 1, 2020 at 5:32 am

Hi there,

Is there a filter on the query used within WP Bakery post grid? If so should be able to help with a snippet to exclude expired events.


Softwired

June 1, 2020 at 9:35 am

There are filters in the WP Bakery post grid element but none that will filter out expired events. My developer is not sure how much coding there is to do. My thought was this may be a common issue as WP Bakery is very popular.

Another thought was a third-party developer might be able to offer an add-on for this. Any other assistance would be greatly appreciated.

Thank you!


Tony

  • Support Staff

June 1, 2020 at 12:14 pm

There are filters in the WP Bakery post grid element but none that will filter out expired events.

I’m referring to filters within the code itself, it sounds like you might using the same term for filters within post grid settings?

My developer is not sure how much coding there is to do.

I’d need to see the plugin, can you send a copy over?

My thought was this may be a common issue as WP Bakery is very popular.

I don’t remember any other threads for WP Bakery Post Grid but that doesn’t mean there aren’t any but this certainly hasn’t been a common question.

Another thought was a third-party developer might be able to offer an add-on for this. Any other assistance would be greatly appreciated.

Apologies but I’m not sure I follow, add-on for which?


Softwired

June 2, 2020 at 8:51 am

This reply has been marked as private.


Tony

  • Support Staff

June 2, 2020 at 9:29 am

You’ll need to host the zip file somewhere (the site itself for example) and then include a link we can use to download it.

Or email it using a service such as WeTrasnfer to send a copy to support[at]eventespresso.com


Softwired

June 3, 2020 at 9:20 am

This reply has been marked as private.


Tony

  • Support Staff

June 8, 2020 at 6:05 am

Ok, so this is actually very simple to do as we have a function to filter events with expired tickets:

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

Add that to a custom functions plugin on the site, we have documentation on how here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

Then, WP Bakery are expressing filters within their queries but they have a filter for it, so in that same plugin you just created add:

add_filter( 'vc_basic_grid_filter_query_suppress_filters', '__return_false' );

That will remove events with expired ticket sales from the output, not it will do so everywhere on the site so if you want it to only happen on specific pages you’ll need to add conditionals to those functions.


Softwired

June 11, 2020 at 9:14 am

Thank you so much for your incredible support. We have implemented the code on our staging site and it seems to be working for some events but not others.

Working:
https://wordpress-154226-1333449.cloudwaysapps.com/classes/music/

Not Working:
https://wordpress-154226-1333449.cloudwaysapps.com/classes/ceramics/
https://wordpress-154226-1333449.cloudwaysapps.com/classes/paint/

If you have any ideas why this might be the case we’d very much appreciate it.

Thank you!


Tony

  • Support Staff

June 11, 2020 at 9:22 am

What events should I see on those ‘not working’ pages?

Right now no events load but that doesn’t necessarily mean the snippet isn’t working.

Have you checked the error log to confirm there are no errors being thrown?


Softwired

June 11, 2020 at 12:12 pm

We can see there should be some events not expired on live site:

https://www.jansenartcenter.org/classes/jewelry/

We are getting this:

The post type tp_event is not registered, so it may not be reliable to check the capability “edit_post” against a post of that type. Please see Debugging in WordPress for more information. (This message was added in version 4.4.0.) in /mnt/data/home/154226.cloudwaysapps.com/yypkxkvndy/public_html/wp-includes/functions.php on line 5167


Softwired

June 11, 2020 at 12:14 pm

Uninitialized string offset: 0 in /mnt/data/home/154226.cloudwaysapps.com/yypkxkvndy/public_html/wp-content/plugins/wp-hummingbird/core/modules/minify/class-uri-rewriter.php on line 128
[11-Jun-2020 16:00:43 UTC] PHP Notice: Uninitialized string offset: 0 in /mnt/data/home/154226.cloudwaysapps.com/yypkxkvndy/public_html/wp-content/plugins/wp-hummingbird/core/modules/minify/class-uri-rewriter.php on line 128


Softwired

June 11, 2020 at 12:17 pm

Wait! I think we found a conflicting plugin. Ultimate VC addons is causing the error.


Tony

  • Support Staff

June 11, 2020 at 1:55 pm

The post type tp_event is not registered, so it may not be reliable to check the capability “edit_post” against a post of that type.

tp_event isn’t an EE post type, we use espresso_ as a prefix.

That looks like its from your sites theme or possible another plugin.

Uninitialized string offset: 0 in /public_html/wp-content/plugins/wp-hummingbird/core/modules/minify/class-uri-rewriter.php on line 128
[11-Jun-2020 16:00:43 UTC] PHP Notice: Uninitialized string offset: 0 in /public_html/wp-content/plugins/wp-hummingbird/core/modules/minify/class-uri-rewriter.php on line 128

Hummingbird is an optimization plugin, so again those aren’t from Event Espresso.

Wait! I think we found a conflicting plugin. Ultimate VC addons is causing the error.

Ok, so what is that plugin doing?


Softwired

June 11, 2020 at 2:08 pm

[11-Jun-2020 16:02:14 UTC] PHP Notice: Undefined index: license-form-method in /mnt/data/home/154226.cloudwaysapps.com/yypkxkvndy/public_html/wp-content/plugins/Ultimate_VC_Addons/admin/bsf-core/BSF_License_Manager.php on line 619

Trying to track down the issue. Here’s the code:

if ( ‘edd’ === $product[‘license_from_type’] || ‘license-key’ === sanitize_text_field( $_GET[ ‘license-form-method’ ] ) ) {


Tony

  • Support Staff

June 11, 2020 at 2:14 pm

A PHP Notice or Warning wouldn’t usually cause any significant issues, its essentially saying ‘you might want to check this out’.

‘Fatal Errors’ are the ones that will stop the script executing and cause no results/blanks screens etc.

So are you sure that plugin is actually conflicting?

Have you tried temporarily disabling it to see if the pages then work as expected?


Softwired

June 12, 2020 at 8:01 am

Hi Tony,

So you were correct. I disabled all plugins and changed the theme and the problem still exists. I changed the page element of WP Bakery and just switching the categories made the results not return anything.

I’m scratching my head here. None of the errors seem to indicate the problem. Is there possibly something on the EE side that could be buried in the data causing this?

After experimenting a little further I’ve pinpointed the problem only seems to be with a few categories. I may try to remove those and reapply. This seems like a possible data issue.


Tony

  • Support Staff

June 12, 2020 at 8:25 am

Ok, this is why I asked for specific events I should be looking for above.

The snippet filters events based on the ticket sale dates set within the event NOT the event status.

So, on this page:

https://www.jansenartcenter.org/classes/jewelry/

I’m guessing it’s only the first 3 events that should be showing?


Softwired

June 12, 2020 at 8:52 am

Oh! Yes, that’s correct. We only want active or upcoming. It looks like once the event Is passed then it goes to an inactive status?


Tony

  • Support Staff

June 12, 2020 at 9:08 am

It looks like once the event Is passed then it goes to an inactive status?

That’s correct because the Event status is based on the datetimes, not the ticket sales dates. Looks like that snippet isn’t going to work for your event set up.

Can you edit this event:

https://www.jansenartcenter.org/events/stackable-rings-2/

Take a screenshot of the ‘Event Tickets and Datetimes’ section for the event and post it here, please?


Softwired

June 12, 2020 at 9:14 am

OK, now that makes sense. Here’s the screenshot https://tinyurl.com/y8sgmm4s


Tony

  • Support Staff

June 12, 2020 at 9:27 am

Hmm, actually that should still be excluded by that snippet. It’s only a single ticket on the event and the sale dates have passed.

Let’s break this down a little more, what exactly did you do here:

I changed the page element of WP Bakery and just switching the categories made the results not return anything.

What do you have set on the above page to display the events?


Softwired

June 12, 2020 at 9:38 am

Here’s where the filter is set in WP Bakery. https://tinyurl.com/y7pt3fd4

After experimentation, it seemed like some categories worked and some didn’t. To me it seemed there could be a data problem. I made a test event and put it in Ceramics with a future date and it showed up. So it’s almost like the old events don’t work but new ones do.


Tony

  • Support Staff

June 12, 2020 at 9:54 am

After experimentation, it seemed like some categories worked and some didn’t.

Within EE there is no difference between categories, they are all created in exactly the same way.

To me it seemed there could be a data problem.

As in?

I made a test event and put it in Ceramics with a future date and it showed up. So it’s almost like the old events don’t work but new ones do.

Sorry but I don’t follow your logic here, you created an event that was expected to show up (it has a future date) and it did actually show up.

How that shows any issue with a query that is filtering out events that have ticket sale end dates set in the past, I’m not sure.

In short, your new test event is expected to show up with that snippet, regardless of the category set.


Softwired

June 12, 2020 at 10:00 am

So, I ran another experiment. I recreated the event identical to the one not showing up and it did. http://wordpress-154226-1333449.cloudwaysapps.com/test/

So it seems there’s a problem in the database. We may try to workaround and just have them recreate the events that aren’t working.


Tony

  • Support Staff

June 12, 2020 at 10:33 am

I guess I’m misunderstanding the problem here.

Can you provide more specific details of the events in question, please? I’m not sure what I should be looking at/comparing against.


Softwired

June 19, 2020 at 10:19 am

Hi Tony,

I’m following up so this thread isn’t left hanging. I love the support you guys have provided, truly over the top.

For some reason the filter isn’t working on some existing categories. It works on new ones we create so our workaround seems to be to recreate the categories.

I’ll follow up if we have any more problems.

Thank you!


Tony

  • Support Staff

June 19, 2020 at 10:32 am

Ah ok, that’s a little strange as it shouldn’t really make any difference but sound like you have it handled anyway.

Thanks for the follow up, and feedback 🙂

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: publish

Updated by  Tony 4 months, 1 week ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!