public function UnInvite($InvitationID = '', $PostBackKey = '') { $this->Permission('Garden.SignIn.Allow'); $InvitationModel = new InvitationModel(); $Session = Gdn::Session(); if ($Session->ValidateTransientKey($PostBackKey)) { try { $InvitationModel->Delete($InvitationID, $this->UserModel); } catch (Exception $ex) { $this->Form->AddError(strip_tags($ex->getMessage())); } if ($this->Form->ErrorCount() == 0) { $this->StatusMessage = T('The invitation was removed successfully.'); } } $this->View = 'Invitations'; $this->Invitations(); }
/** * Revoke an invitation. * * @since 2.0.0 * @param int $InvitationID Unique identifier. * @throws Exception Throws an exception when the invitation isn't found or the user doesn't have permission to delete it. */ public function UnInvite($InvitationID) { $this->Permission('Garden.SignIn.Allow'); if (!$this->Form->AuthenticatedPostBack()) { throw ForbiddenException('GET'); } $InvitationModel = new InvitationModel(); $Session = Gdn::Session(); try { $Valid = $InvitationModel->Delete($InvitationID, $this->UserModel); if ($Valid) { $this->InformMessage(T('The invitation was removed successfully.')); $this->JsonTarget(".js-invitation[data-id=\"{$InvitationID}\"]", '', 'SlideUp'); } } catch (Exception $ex) { $this->Form->AddError(strip_tags($ex->getMessage())); } if ($this->Form->ErrorCount() == 0) { $this->Render('Blank', 'Utility'); } }