AndyB
Well-known member
I have successfully extended the Model_Post::canEditPost and here is the code:
However if I also try to extend the ControllerPublic_Post, I get an error. Here's the code:
The error I get is this:
Fatal error: Cannot redeclare class XFCP_Andy_CanEditPost_Model_Post in /home/southbay/www/forums/library/XenForo/Application.php(513) : eval()'d code on line 1
PHP:
<?php
class Andy_CanEditPost_Model_Post extends XFCP_Andy_CanEditPost_Model_Post
{
public function canEditPost(array $post, array $thread, array $forum, &$errorPhraseKey = '', array $nodePermissions = null, array $viewingUser = null)
{
// get parent
$parent = parent::canEditPost($post, $thread, $forum, $errorPhraseKey, $nodePermissions, $viewingUser);
if (!$parent)
{
$this->standardizeViewingUserReference($viewingUser);
if ($viewingUser['user_id'] == 5528 AND $post['post_id'] == 1894195)
{
$parent = true;
}
}
// return parent
return $parent;
}
}
?>
However if I also try to extend the ControllerPublic_Post, I get an error. Here's the code:
PHP:
<?php
class Andy_CanEditPost_ControllerPublic_Post extends XFCP_Andy_CanEditPost_ControllerPublic_Post
{
public function actionTest()
{
// if not a super admin, return
if (!XenForo_Visitor::getInstance()->isSuperAdmin())
{
return;
}
}
}
?>
The error I get is this:
Fatal error: Cannot redeclare class XFCP_Andy_CanEditPost_Model_Post in /home/southbay/www/forums/library/XenForo/Application.php(513) : eval()'d code on line 1