protected function beforeInsert() { parent::beforeInsert(); if ($this->datePosted_db == null) $this->datePosted = time(); $this->timePosted = time(); if ($this->commentsAllowed && $this->commentsOpenFor) { $this->commentsCloseDate = time() + 60*60*24*$this->commentsOpenFor; } }