Support

Account

Home Forums General Issues Update a field 30 Days after

Helping

Update a field 30 Days after

  • Hi,

    I am having trouble finding a solution.
    I would like a field to automatically change its value 7 days after the post author has chosen a value.
    I am using a select field (Featured) with 2 values (Featured, Not Featured).

    If you have a solution with a different type a field that would work too.

    Your help is greatly appreciated.

  • A cronjob based approach would be the best way, store the values in variables and change the variable with code executed by a cronjob, I found a quite extensive thread on Stackoverflow

    Stackoverflow

    To summarise it I quote one of the Threads in case it gets closed

    [shortened quote] The script will only run if you have a cron-job or someone access the page. (and a cron job is basically the computer accessing the page at a specific time!)

    If you want a variable dependant on time of day simply use a if statement

    (pseudo code)

    if(now() < $time){
        $var = 1;
    }else{
        $var = 2;
    }

    This means that anyone who visits the page before $time gets $var1 and after gets $var2

    You will also find an introduction to cronjobs here

    Cron Jobs

    The big question is if you are familiar with cron jobs and if your hosting environment allows them.

    I hope this will put you on the right track!

    Cheers
    Johannes

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.