I’m trying to create a site that has a queue of content. Each piece of content is only to be shown for 5 minutes, then the next piece is shown. I want the timing to be ‘global’ - let’s say the content starts showing at midnight UTC, but the first visitor to the site only comes in at 00h11, so 11 minutes past midnight. By this time, 2 pieces of content should have been shown already (which the user obviously hasn’t seen), and the user will only see the third piece of content for 4 minutes before the next piece is shown.
I’d also like to be able to organise the order of the content to move some pieces ahead of others in the queue, or even schedule them to be shown at particular times.
You can absolutely make this happen if the Content data type has a date/time field.
The date/time field would be used to dictate when to show the content:
Search for Content :first item
where the search has a constraint: date/time is greater than or equal to current date/time
Regardless of the timezone the user is in, Bubble saves date/time values as UNIX timestamps. So, it’ll always be the same point in time.
If you create a Content record and save it’s date/time to Feb 1 08:00 in New York, then you will see it at 08:00. Someone in Paris would see it at 14:00 their time, but you’re both seeing it at the same time.
This also means that if you have it set to show at 08:00, and another user comes in at 08:06 (or whatever the equivalent is in their timezone), they’ve still missed that first Content record.
As Gaby describes, your page can pull the relevant content depending on time. Bear in mind that “time” on the page will need to be updated, if you want to content to automatically switch over.
The alternative is to have a regular event that pushes the content to the current view every 10 minutes. So the page shows the current content, and then something runs (API workflow etc) to change it to the next in the queue.
Got it working in about 5 minutes! ‘Do something every x seconds’ also worked well, just updated a tag on each content piece so that it falls outside the RG’s search.