/** * Toggle discussion answered manually. */ public function DiscussionController_Answered_Create($Sender, $Args) { $Sender->DeliveryType(DELIVERY_TYPE_BOOL); list($DiscussionID, $TransientKey) = $Args; $Session = Gdn::Session(); $DiscussionModel = new DiscussionModel(); if (is_numeric($DiscussionID) && $DiscussionID > 0 && $Session->UserID > 0 && $Session->ValidateTransientKey($TransientKey)) { $DiscussionModel->AnswerDiscussion($DiscussionID); } // Redirect back where the user came from if necessary if ($Sender->DeliveryType() === DELIVERY_TYPE_ALL) { Redirect(GetIncomingValue('Target', 'discussions/unanswered')); } $Sender->InformMessage(T('Your changes have been saved.')); $Sender->Render(); }