/** * Unpin specific discussion * * @param void * @return null * */ function unpin() { if (!$this->request->isSubmitted()) { $this->httpError(HTTP_ERR_BAD_REQUEST, null, true, $this->request->isAsyncCall()); } // if if (!$this->active_discussion->canChangePinedState($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isAsyncCall()); } // if $this->active_discussion->setIsPinned(false); $save = $this->active_discussion->save(); if ($save && !is_error($save)) { flash_success('Discussion has been successfully unpinned'); $activity_log = new DiscussionUnpinnedActivityLog(); $activity_log->log($this->active_discussion, $this->logged_user); } else { flash_error('Failed to unpin selected discussion'); } // if $this->redirectToReferer($this->active_discussion->getViewUrl()); }