XF 2.2 How to automatically lock and unlock a specific thread using CRON?

puterfixer

Member
Hello,

I have a thread that is supposed to be open for posts just 24 hours per month - on the 13th of each month, for people to vent their frustrations and get some laughs and group therapy of sorts. :)

So far the locking/unlocking was done manually, but it's annoying, and I'm sure there can be at least one way to automate it.

But... how? :)

The lowest hanging fruit would be to run two CRON jobs with the right parameters to lock or unlock the thread. This could be either some API call, or some SQL script to change the flag in the database directly (although I'm reluctant to have the DB connection string with the username and password in two other places, not just the forum config file).

Has anyone done something similar before? Could you perhaps point me in the right direction?

Many thanks in advance!
 
You could write a simple curl script and use the POST threads API endpoint to set the discussion_open status.


1673381147874.png
 
Top Bottom