public function process() { if (!$this->post->remove(array(), true, true)) { $this->modx->log(modX::LOG_LEVEL_ERROR, '[Discuss] Could not remove post: ' . print_r($this->post->toArray(), true)); } else { $this->discuss->logActivity('post_spam_remove', $this->post->toArray(), $this->post->getUrl()); } if ($this->thread->get('post_first') == $this->post->get('id')) { $redirectTo = $this->discuss->request->makeUrl('board', array('board' => $this->post->get('board'))); } else { $redirectTo = $this->thread->getUrl(); } $this->modx->sendRedirect($redirectTo); }
public function process() { $this->setPlaceholders($this->thread->toArray()); if ($this->post->remove()) { $this->discuss->logActivity('message_post_remove', $this->post->toArray(), $this->post->getUrl()); $posts = $this->thread->getMany('Posts'); if (count($posts) <= 0) { $url = $this->discuss->request->makeUrl('messages'); } else { $url = $this->discuss->request->makeUrl('messages/view', array('thread' => $this->thread->get('id'))); } $this->modx->sendRedirect($url); } }
public function process() { if (!$this->post->remove(array(), true)) { $this->modx->log(modX::LOG_LEVEL_ERROR, '[Discuss] Could not remove post: ' . print_r($this->post->toArray(), true)); } else { $this->discuss->logActivity('post_remove', $this->post->toArray(), $this->post->getUrl()); } /* If the thread no longer exists (last post in thread was removed), redirect to the board instead of thread */ if ($this->modx->getCount('disThread', $this->thread->get('id')) < 1) { $redirectTo = $this->discuss->request->makeUrl('board', array('board' => $this->post->get('board'))); } else { $redirectTo = $this->thread->getUrl(); } $this->modx->sendRedirect($redirectTo); }