Myke623
Well-known member
I know this is unmaintained, but has anyone noticed that for promoting threads for the Recent News, the Promotion Date is being (re)set to 1 January 1970?
Not being able to manually enter the date means that the only work-around is to use the date picker and tediously scroll month by month, all the way from January 1970 to the present.
If someone has encountered this issue and has a fix, please let me know!
Found the problem, and it was to do with the timezone.
In my particular case, my timezone is Australian Eastern Standard Time (AEST). The issue is that the timezone being used in the promotion date is the abbreviation (AEST), as shown in EWRporta/ControllerPublic/Thread.php:
PHP:
$datetime = explode('.', $datetime->format('Y-m-d.h.i.A.T'));
T = Timezone abbreviation (ref: http://php.net/manual/en/function.date.php)
And when the promotion date gets written in EWRporta/Model/Promotes.php:
PHP:
$datetime = $input['date']." ".$input['time']." ".$input['ampm']." ".$input['zone'];
$dw->bulkSet(array(
'thread_id' => $input['thread_id'],
'promote_date' => strtotime($datetime),
'promote_icon' => $input['promote_icon'],
));
The promote date is constructed via the 'strtotime' function which (for some reason) no longer likes the AEST abbreviation. It used to though! So whenever I was promoting threads, the 'strtotime' function was returning 0 (zero), which resulted in the epoch date of 1 January 1970.
To fix this, I changed the timezone from using the abbreviation to using the timezone identifier (Australia/Sydney), which 'strtotime' seems to be happy with. In file EWRporta/ControllerPublic/Thread.php, change the 'T' in the format to an 'e':
PHP:
$datetime = explode('.', $datetime->format('Y-m-d.h.i.A.e'));