From 712812332dd02d3f09384450983b999ab113e297 Mon Sep 17 00:00:00 2001 From: "Nathan J. Brauer" Date: Fri, 8 Sep 2023 23:06:32 -0700 Subject: [PATCH] Bugfix: Updating BlogPostFilter::augmentSQL to make use of modern Versioned methods. This resolves an issue with some modules that rely upon get_draft_site_secured, like Elemental and sharedraftcontent --- src/Model/BlogPostFilter.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Model/BlogPostFilter.php b/src/Model/BlogPostFilter.php index d3728ebf8..e296864df 100644 --- a/src/Model/BlogPostFilter.php +++ b/src/Model/BlogPostFilter.php @@ -28,13 +28,17 @@ class BlogPostFilter extends DataExtension */ public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null) { - $stage = Versioned::get_stage(); if (Controller::has_curr() && Controller::curr() instanceof LeftAndMain) { return; } - if ($stage == 'Live' || !Permission::check('VIEW_DRAFT_CONTENT')) { + if (Versioned::get_stage() === Versioned::LIVE || + ( + Versioned::get_draft_site_secured() && + !Permission::check('VIEW_DRAFT_CONTENT') + ) + ) { $query->addWhere(sprintf( '"PublishDate" < \'%s\'', Convert::raw2sql(DBDatetime::now())