Fix showing comments older than one week in the "latest comments" view

This commit is contained in:
Flavio Copes 2016-09-16 09:51:01 +02:00
parent c1e3f69a96
commit 7b4f3a4e8d
2 changed files with 6 additions and 5 deletions

View File

@ -1,3 +1,9 @@
# v1.2.x
## 09/16/2016
1. [](#bugfix)
* Fix [#37](https://github.com/getgrav/grav-plugin-comments/issues/37) showing comments older than one week in the "latest comments" view
# v1.2.4 # v1.2.4
## 09/15/2016 ## 09/15/2016

View File

@ -312,11 +312,6 @@ class CommentsPlugin extends Plugin
for ($i = 0; $i < count($data['comments']); $i++) { for ($i = 0; $i < count($data['comments']); $i++) {
$commentTimestamp = \DateTime::createFromFormat('D, d M Y H:i:s', $data['comments'][$i]['date'])->getTimestamp(); $commentTimestamp = \DateTime::createFromFormat('D, d M Y H:i:s', $data['comments'][$i]['date'])->getTimestamp();
$sevenDaysAgo = time() - (7 * 24 * 60 * 60);
if ($commentTimestamp < $sevenDaysAgo) {
continue;
}
$data['comments'][$i]['pageTitle'] = $data['title']; $data['comments'][$i]['pageTitle'] = $data['title'];
$data['comments'][$i]['filePath'] = $file->filePath; $data['comments'][$i]['filePath'] = $file->filePath;