Gossamer
Active member
I've been making good progress with my add-on, but when trying to check permissions on a delete function, I end up receiving the error below:
And here is my code.
ControllerPublic
Model
Server Error
Undefined variable: errorPhraseKey
- XenForo_Application::handlePhpError() in Goss/Reservations/ControllerPublic/Reserves.php at line 108
- goss_Reservations_ControllerPublic_Reserves->actionDelete() in XenForo/FrontController.php at line 347
- XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
- XenForo_FrontController->run() in C:/xampp/htdocs/Xenforo_DEV/index.php at line 13
And here is my code.
ControllerPublic
PHP:
public function actionDelete()
{
$id = $this->_input->filterSingle('id', XenForo_Input::UINT);
if (!$this->_getReserveModel()->canDeleteReserve($errorPhraseKey))
{
throw $this->getErrorOrNoPermissionResponseException($errorPhraseKey);
}
//Create a instance of our DataWriter
$dwReserve = XenForo_DataWriter::create('Goss_Reservations_DataWriter_Reserves');
$dwReserve->setExistingData($id);
$dwReserve->delete();
return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
$this->getDynamicRedirect()
);
}
Model
PHP:
public function canDeleteReserve(array $ViewingUser = null, &$errorPhraseKey = '', array $nodePermissions = null)
{
$this->standardizeViewingUserReference($viewingUser);
if(!$viewingUser['user_id'])
{
return false;
}
if(!XenForo_Permission::hasPermission($viewingUser['permissions'], 'Reserves', 'deleteReserve'))
{
return false;
}
else
{
return true;
}
}
Last edited: