How can I make an element visible for a fixed period of time after an event takes places?

I have a directory where users can purchase a “featured listing.” This involves a simple tag appearing on their post, and their post displays at the top of a repeating group. However, I do NOT want their listing to be “featured” forever. If I only wanted the database object’s “feature” field to be set to “Yes” for 48 hours from the date of their successful Stripe purchase, how can I do it?

Thanks!

1 Like

Hi there, @clark.nc… one way to do what you have described is to have a featured until (date) field on the post data type, and set that field appropriately (current date/time plus 2 days) upon a successful stripe purchase. Then, use that field to create the desired result on the front end.

Hope this helps.

Best…
Mike

1 Like

Ah, makes sense! Thank you for the response - I’m going to give it a try.

1 Like

So… I implemented what you suggested. This works great for getting the “tag” on the front end to disappear after the desired length of time expires. However, I’m running into trouble because I need the “Featured” field to also switch to “no” for purposes of sorting the repeating group. I’m not sure how to accomplish this in Bubble. Basically… when “Featured Until” is < “Current Date and Time”, I need the “Featured” Yes/No option to be set to “No”. Any ideas?

I wouldn’t want to deal with that Featured field at all, so how about merging two searches? Do a search with a constraint that brings back only the featured posts, and merge that search with a search that brings back the non-featured posts. That works like a charm in my head. :slight_smile:

Ah, this would be something new for me - but it sounds perfect! I didn’t realize I could slap 2 different searches into a RG. Going to give it a try!

1 Like