Posted: June 2, 2021 at 5:41 am
How do we stop an event from showing in the events list when it has started? We have this events page which is a customised page from our own theme: We want to change this so that events are no longer shown once one (or any) of the datetime have started. Currently the client is marking the event as Sold Out but this prevents easy reporting and filtering on the WP back-end.
They also commented:
Any help would be much appreciated. Thanks, |
|
Hi there,
To remove those you’ll need to add a snippet to the site, this should do it: https://gist.github.com/joshfeck/646d496e72942b5251d484d522d762ee You can add that to a custom functions plugin on your site, we have some documentation on creating one here: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/
Apologies but I’m not sure I follow, can you add some additional details on this? An event with a DateTime that is happened now() will show as Active, if it then has a DateTime set on a later date then once the current DateTime has expired it should once again show upcoming. |
|
Hi Thank you for the reply and sorry for the delay coming back to you – I was away on holiday last week.
I have added this and asked the client to check.
I think this can be ignored if the above gist works. I will report back. Thanks, |
|
Hi I have another question from our client using EE. We run a one ticket event training course that runs over several days/sessions. In the event we are adding all of these sessions as datetimes. The feedback from out client is the following:
I’m not sure if the gist you sent will help us on this? Any advice would be appreciated. Thanks, |
|
Can you post an example event so I can view this? When the current date/time is between the event datetime’s start/end date and time, the event should show as active, when that datetime passes, if there is another datetime in the future the event should again show as upcoming. |
|
Hi Tony, Thank you for the reply. The events are changing every week but here is the current events: https://www.mariamontessori.org/events/ In this I don’t think we have an example to show you. I think what the client is asking for is when an event’s first datetime starts until the last, can it show as active instead of upcoming? |
|
No, not currently but just clarify, is this within the admin? An event will only show as active when it has an ‘active’ DateTime at the time of the request. So, on that event you linked me to it will next show as ‘active’ on 19th June between 9:30am and 11:30am, after that it will again switch to ‘upcoming until’ 26th June 9:30-11:30am and then again switch to active etc. I see you’re using the events as a collection of sessions and consider it ‘active’ from session 1 though to the final session, EE can’t be changed to consider an event active throughout all of the datetimes currently. You could add an additional column to the events list table to give some indication of that using the hooks available within EE but its not something we have built in. |
|
Hi Tony, Thanks for your help so far. I have spoken with the client and have something I would appreciate your thoughts on. We currently run a course that runs over multiple dates and one ticket gets access to all of the dates so we are using Datetimes for each of the days. This creates an issue where tickets are still available for sale even after it has started. We are planning on stopping using the Datetimes and only adding the dates as plain text as a custom field as we want ticket sales to stop when the event session starts and we want it to only show as ACTIVE during that period. Does this sound doa-ble and are there any issues with doing it this way? Thanks, |
|
Tickets within Event Espresso require the use of a datetime, you can stop outputting them on the front end but internally the tickets will still need to be assigned to to datetime. That means that everywhere else that is outputting dates will need some form of change (be it code or template changes) to stop EE from outputting the datetime values and use your custom field. However, I’m still not sure I understand why the datetime showing active is an issue. If I can understand the problem better we may be able to help point you in the right direction to fix it.
From the above it sounds like you want ticket sales to stop when the first session starts, is that correct? Meaning you have say: Course Ticket = $100 Datetime 1 = Monday 5th July You want that ticket to only be available up until a specific date? After that closed? So say you want ticket sales for that course to stop when Datetime 1 starts, can you not just set the ‘Sell until’ date of the ticket to be Monday 5th July?
I’m not sure I follow why this is an issue, I guess I’m missing something obvious with it but switching from Upcoming to Active during the times when a datetime is ‘active’ (meaning happening now) seems the most logic thing we can do with EE? |
|
Hi Tony Thank you for the reply and sorry for the delay coming back. Our client runs training courses that run on several over several sessions. Buying a ticket gives you access to all sessions as it is part of the full course and you cannot buy a ticket for just one of those sessions. 1) They are adding the event and then each of the DateTimes for each of the sessions and want the event to no longer to appear once the FIRST session has started. They also don’t want tickets to be available once the first session has started and you have covered this off by using the ‘Sell until’ date. 2) The part around switching from ACTIVE to UPCOMING probably relates to their confusion as internally once the first session has started the entire course is active as far as they are concerned. We want the events to no longer to appear on lists (like the events) page when they have started the first session. Thank you again for your help. |
|
Sorry, one thing I missed off. We added the code in this Gist: But it is not working as expected – it looks like this prevents an event from showing dependant on its Datetime. Is it possible to change this to not show the event if no tickets are available using the ‘Sell Until’ value? Thanks, |
|
It sounds like that snippet is working as expected (removing the events based on the Datetime start date), but it’s not the right snippet for you and I think you need this: If you are setting all of the tickets ‘sell until’ dates to match the first Datetime start date (or even a date before that) then the above will remove the event(s) once that date is reached. — WRT the Active/Upcoming status, changing out how the status works is going to be fairly involved. It’s likely possible (and we are open to adding additional hooks in the if need be), but will require you to hook into various places to set it up correctly. For example, changing the event status column on the Event Espresso -> Events list table section to show how you are requesting is possible, you’ll need your own custom code to hook in and replace that column with a function that outputs the ‘correct’ status based on your requirements. However, if the end user then wants to filter ‘active’ events on that table, the query will use what EE expects as active and not your version of active, so you hook in there and alter the query (again possible to do) until they want to specifically pull those types of events to display on the font end, more custom code to work for those requirements and so on. (It’s important to note here that because of the above we wouldn’t walk through changing this in every location needed as it’s basically a custom feature based on the datetimes of the event. I know you haven’t asked us to but just wanted to clarify so you have all of the information to make a decision from here) What about adding an additional column to the event list table and using that to identify if the course has already started? For example, you could add an additional column that always pulls in the ‘first’ DateTime from the event and shows it as ‘Course start date’. You could also then change the current ‘Event Start’ column title to ‘Next Session Date’. That would look something like this: https://monosnap.com/file/krfJurQwiSQljW4gFogW52jSKSE8qt |
|
The support post ‘How do we stop an event from showing in the events list when it has started?’ 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.