AndyB
Well-known member
My default edit time limit for regular members is 24 hours. What I would like to do is create an add-on which will allow me to override this default value on a per post basis.
If I hack the following code like this it works perfect:
However when I try to extend Xenforo_Model_Post::canEditPost the Edit link appears properly below the post, but clicking the link produces a "You do not have permission to view this page or perform this action." error message.
Here is my add-on code which only partially works:
Thank you.
If I hack the following code like this it works perfect:
PHP:
public function canEditPost(array $post, array $thread, array $forum, &$errorPhraseKey = '', array $nodePermissions = null, array $viewingUser = null)
{
$this->standardizeViewingUserReferenceForNode($thread['node_id'], $viewingUser, $nodePermissions);
// start hack
if ($viewingUser['user_id'] == 5528 AND $post['post_id'] == 1894195)
{
return true;
}
// end hack
<snip>
However when I try to extend Xenforo_Model_Post::canEditPost the Edit link appears properly below the post, but clicking the link produces a "You do not have permission to view this page or perform this action." error message.
Here is my add-on code which only partially works:
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 ($viewingUser['user_id'] == 5528 AND $post['post_id'] == 1894195)
{
return true;
}
// return parent
return $parent;
}
}
?>
Thank you.