I have a database field which has a timestamp in it, named datalastupdate.
I have an admin option, named helpcenter_auto_close which sets the period of time that has to pass.
I have the following php code:
PHP Code:
<?php
if ($vbulletin->options['helpcenter_auto_close']>0){
$ticketreply = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX ."helpcenter_ticket");
while ($ticket = $vbulletin->db->fetch_array($ticketreply))
{
$ticketid = $ticket['ticketid'];
$hc_time1 = $vbulletin->options['helpcenter_auto_close'];
$hc_time1 = TIMENOW;
$hc_timediff = intval($hc_time1-$hc_time2);
if ($ticket['datelastupdate'] <= $hc_timediff){
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX ."helpcenter_ticket SET ticketstatus=0 WHERE ticketid=$ticketid");
}
}
}
?>
I'm trying to get it so that if the ticket has not been replied to for the set period in the admin options then it will close the ticket, but it wont work. Im doing this will a scheduled task.
I cant see what i'm doing wrong, can anybody help me?