“Dating Game” Challenge — Field Timers — How To?

I've searched hereabouts and in the docs, but the cartoon lightbulb floating over my head is still dark. Help? Is something like the following even possible?

Members can log in. Check. No problem.

Members can edit and save their own biography and other info about themselves, like phone numbers, addresses, and so on. Ditto. Can do.

Here's where things start to get interesting...

Members each have a field called, e.g., "availability". Think of it as something like a traffic light or signal to other members. It has 4 states: “yes”, “maybe”, “no”, and “never”. In our traffic light analogy, those equate to a light that’s, respectively, “green”, “amber/yellow”, “red”, or “off”.

The default state is “yes” (green), meaning that the member is available.

Any member can freely set their availability status to any of the other values. Same as with an address or phone number, it is what they say it is.

Except...

I need “maybe” (yellow) to auto-magically reset itself to “yes” after an Admin-specified duration, like, say, 2 weeks.

So, the idea here is basically a field-specific “timer.” I.e.,...

IF a member sets their availability to “maybe” (yellow),

THEN the timer starts running, so to speak,

AND, after whatever specified duration, the timer metaphorically goes “ding!” and automatically resets the member’s availability--changing it back from “maybe” (yellow) to “yes” (green) all by itself--no matter whether or not that particular member, or anyone else, ever signs in again.

That's where my head-scratching begins.

I’m eyeballing global variables like {{ current_date }} and wondering... Is this even “do-able” with straight-out-of-the-box Statamic? Or do I (*cringe*) need something php-ish? (Which language I no speak.)

Answered by Jason Varga!
>>>>>>> Answered <<<<<<<
3 Replies
2 Followers