Posted: March 2, 2018 at 5:28 pm
|
Hi Am I right in saying that if someone starts the registration process and leaves the site EE will reserve that ticket for 1 hour? That is way too long for my client who sells motorbike training classes with 11 seats max….. They can get 20-30 boookinds per day so quite busy and if just a few get reserved blocking others from booking they’ll go to a competitor…. Is there any way to have the ticket released as soon as they navigate away from the registration form? or even to reduce it from 1 hour to something much smaller? Josh I see you have created a plugin that sets up a cron to purge reserved tickets each hour…. could that be used to also run every 10 mins? or could that kill off an active registration thats in progress too? Any advice welcome as my client really needs a solution to this Thanks so much |
Yes, the default session lifespan is 1 hour.
No, because there’s no reliable way for EE to know that has happened. But…
Yes, you can change the lifespan using a filter, something like this: https://gist.github.com/Pebblo/b6e20b03c57efe693bd86ebcf1b00ce9 Will set the session lifespan to 15mins which is the loest value I would use personally. You can add that to your child themes functions.php file or preferably a custom functions plugin: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ Note that users would need to select ticket, provide all of the registration information you are requesting and complete payment before the session expires. If they get half way through and the session ends the will need to restart the registration from the beginning again.
The session lifespan is how long the session is considered active, the cron job is the function that removes the ‘expired’ reserved tickets and adds them back to the available tickets. So it’s the session lifespan that will kill off active registrations, not the cron. The shortest cron interval WP has by default is ‘hourly’ so if you want the above to run more frequently you would need you own custom cron interval of say 15 mins, doing so isn’t all that complicated and heres and example of adding a custom interval: https://wordpress.stackexchange.com/questions/208135/how-to-run-a-function-every-5-minutes (Thats for 5 mins, you would be better with 15 imo, but that’s up to you) Something to keep in mind is additional wp_crons, especially shorter interval crons, will increase the load on the server. The alternative is to disable WP_CRON and set up a real cron job on your site, theres a like with an explanation on doing so in the stackexchange thread I linked to. |
|
|
Hi Tony Thanks so much for that great explanation. I have now implemented your code to my plugin to set session to expire after 15 minutes. I might add a note at the start of the registration that tells people their ticket is reserved for 15 mins only… So after 15 minutes the session expires but am I right in saying that the ticket is still reserved and taking up 1 space on that event until the hourly purge takes place on expired reserved tickets? I can’t now for the life of me find that post or solution that I’m sure Josh posted on here or github to purge expired reserved tickets every say 15 mins? Anyone know if I need that as well or where to find it thank you so much |
That’s correct.
I think the thread you are referring to is this one: Which links to this code: https://gist.github.com/joshfeck/19cf49a2a30e939cca6d0a7014f7c183 It adds another hourly cron event as well as the default event to make sure the ticket reservation are reset. If you want a more frequent reset than hourly you’ll need to add your own schedule as hourly is the shortest default from WP. |
|
|
Hi Tony Thanks for getting that link for me… I’ve now added that code to my custom plugin and have installed an advanced cron plugin so i can see all cron tasks and schedules. I can see the new tasks set for hourly and using these schedules I can change it from “hourly” to “twiceanhour” to get it to run every 30 mins Great 🙂 |
The support post ‘Tickets are reserved for too long?’ 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.