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:
3Dgoo 2018-06-26 13:17:47 +09:30 committed by GitHub
parent ae4bcebc46
commit ce1dee51d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,7 +100,8 @@ 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(array('"PublishDate" <= ?' => SS_Datetime::now()->Format('Y-m-d H:i:s'))); ->addLeftJoin('SiteTree' . $suffix, '"SiteTree' . $suffix . '"."ID" = "BlogPost' . $suffix . '"."ID"')
->addWhere(array('"PublishDate" <= ?' => SS_Datetime::now()->Format('Y-m-d H:i:s'), 'SiteTree' . $suffix . '.ParentID' => $this->BlogID));
$posts = $query->execute(); $posts = $query->execute();
$result = new ArrayList(); $result = new ArrayList();