/** * Delete an activity item. * * @since 2.0.0 * @access public * * @param int $ActivityID Unique ID of item to delete. * @param string $TransientKey Verify intent. */ public function Delete($ActivityID = '', $TransientKey = '') { $Session = Gdn::Session(); if (!$Session->ValidateTransientKey($TransientKey)) { throw PermissionException(); } if (!is_numeric($ActivityID)) { throw Gdn_UserException('Invalid activity ID'); } $HasPermission = $Session->CheckPermission('Garden.Activity.Delete'); if (!$HasPermission) { $Activity = $this->ActivityModel->GetID($ActivityID); if (!$Activity) { throw NotFoundException('Activity'); } $HasPermission = $Activity['InsertUserID'] == $Session->UserID; } if (!$HasPermission) { throw PermissionException(); } $this->ActivityModel->Delete($ActivityID); if ($this->_DeliveryType === DELIVERY_TYPE_ALL) { Redirect(GetIncomingValue('Target', $this->SelfUrl)); } // Still here? Getting a 404. $this->ControllerName = 'Home'; $this->View = 'FileNotFound'; $this->Render(); }