diff --git a/lang/en/lang.php b/lang/en/lang.php index 52835a76..9fa55423 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -52,6 +52,7 @@ 'updated_date' => 'Updated date', 'published' => 'Published', 'published_by' => 'Published by', + 'current_user' => 'Current user', 'published_date' => 'Published date', 'published_validation' => 'Please specify the published date', 'tab_edit' => 'Edit', diff --git a/lang/nl/lang.php b/lang/nl/lang.php index 2d00445b..9572bf76 100644 --- a/lang/nl/lang.php +++ b/lang/nl/lang.php @@ -43,6 +43,7 @@ 'updated_date' => 'Bijgewerkt op', 'published' => 'Gepubliceerd', 'published_by' => 'Gepubliceerd door', + 'current_user' => 'Huidige gebruiker', 'published_date' => 'Gepubliceerd op', 'published_validation' => 'Graag een publicatie datum opgeven', 'tab_edit' => 'Bewerken', diff --git a/models/Post.php b/models/Post.php index 2e781d8c..869e7d0b 100644 --- a/models/Post.php +++ b/models/Post.php @@ -139,6 +139,10 @@ public function afterValidate() public function beforeSave() { + if (empty($this->user)) { + $user = BackendAuth::getUser(); + $this->user = $user->id; + } $this->content_html = self::formatHtml($this->content); } diff --git a/models/post/fields.yaml b/models/post/fields.yaml index f29d0cec..e105cc4f 100644 --- a/models/post/fields.yaml +++ b/models/post/fields.yaml @@ -50,6 +50,7 @@ secondaryTabs: span: right type: relation nameFrom: login + emptyOption: rainlab.blog::lang.post.current_user published_at: tab: rainlab.blog::lang.post.tab_manage