From b55c7aa80dbba693cb1932e1a422187787b28d83 Mon Sep 17 00:00:00 2001 From: Jellygnite Date: Thu, 3 Mar 2022 18:12:36 +1000 Subject: [PATCH] ENH Add config to control if a default author is added to posts on creation --- src/Model/BlogPost.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Model/BlogPost.php b/src/Model/BlogPost.php index 25d67f44..6c092d10 100644 --- a/src/Model/BlogPost.php +++ b/src/Model/BlogPost.php @@ -176,6 +176,13 @@ class BlogPost extends Page */ private static $minutes_to_read_wpm = 200; + /** + * Control whether the current member is added to list of authors when a post is created + * + * @var bool + */ + private static $add_default_author = true; + /** * Sets the upload directory for featured images to help keep your files organised * @@ -818,7 +825,7 @@ protected function onBeforeWrite() { parent::onBeforeWrite(); - if (!$this->exists() && ($member = Security::getCurrentUser())) { + if (!$this->exists() && $this->config()->get('add_default_author') && ($member = Security::getCurrentUser())) { $this->Authors()->add($member); } }