/** * Save topic and handle stats updated. * * @return boolean */ public function save_post() { if ($this->unsaved_post) { $this->unsaved_post->is_valid(); $area = $this->area(); if (!$this->id) { // New topic $this->save(); $this->unsaved_post->forum_topic_id = $this->id; $this->unsaved_post->save(); $this->created = $this->unsaved_post->created; $this->first_post_id = $this->unsaved_post->id; $area->topic_count++; } else { // Old topic $this->unsaved_post->save(); } // Topic stats $this->last_post_id = $this->unsaved_post->id; $this->last_poster = $this->unsaved_post->author_name; $this->last_posted = $this->unsaved_post->created; $this->post_count++; $this->save(); // Area stats $area->last_topic_id = $this->id; $area->post_count++; $area->save(); return true; } return false; }