mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
ENH Add config to control if a default author is added to posts on creation
This commit is contained in:
parent
75d0a7dae6
commit
b55c7aa80d
@ -176,6 +176,13 @@ class BlogPost extends Page
|
|||||||
*/
|
*/
|
||||||
private static $minutes_to_read_wpm = 200;
|
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
|
* Sets the upload directory for featured images to help keep your files organised
|
||||||
*
|
*
|
||||||
@ -818,7 +825,7 @@ class BlogPost extends Page
|
|||||||
{
|
{
|
||||||
parent::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);
|
$this->Authors()->add($member);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user