delete() public method

public delete ( string | unknown_type $InvitationID ) : boolean
$InvitationID string | unknown_type
return boolean
Ejemplo n.º 1
0
 /**
  * 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');
     }
 }