public function onBeforeWrite() { if (!$this->AuthorID) { $this->AuthorID = Member::currentUserID(); } parent::onBeforeWrite(); }