mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Fix blog archive widget bug
Fixes blog archive widget bug to only get the archive months for the blog linked to in this widget.
This commit is contained in:
parent
ec116870f5
commit
01c1ead069
@ -124,7 +124,11 @@ class BlogArchiveWidget extends Widget
|
|||||||
$query = SQLSelect::create($fields, '"BlogPost' . $suffix . '"')
|
$query = SQLSelect::create($fields, '"BlogPost' . $suffix . '"')
|
||||||
->addGroupBy($publishDate)
|
->addGroupBy($publishDate)
|
||||||
->addOrderBy('"PublishDate" DESC')
|
->addOrderBy('"PublishDate" DESC')
|
||||||
->addWhere(['"PublishDate" <= ?' => DBDatetime::now()->Format(DBDatetime::ISO_DATETIME)]);
|
->addLeftJoin('SiteTree' . $suffix, '"SiteTree' . $suffix . '"."ID" = "BlogPost' . $suffix . '"."ID"')
|
||||||
|
->addWhere([
|
||||||
|
'"PublishDate" <= ?' => DBDatetime::now()->Format(DBDatetime::ISO_DATETIME),
|
||||||
|
'SiteTree' . $suffix . '.ParentID' => $this->BlogID,
|
||||||
|
]);
|
||||||
|
|
||||||
$posts = $query->execute();
|
$posts = $query->execute();
|
||||||
$result = ArrayList::create();
|
$result = ArrayList::create();
|
||||||
|
Loading…
Reference in New Issue
Block a user