Earl
Well-known member
This maybe a silly question, but I really need to know if there is a possible way to do this.
for an instance lets say if I need to add a new inline mod option to $postModOptions in library/XenForo/Model/Post.php line: 959
what if I wanna add something like
to the method?
Should I create the whole method with the same name? does it replace the XenForo core codes?
for an instance lets say if I need to add a new inline mod option to $postModOptions in library/XenForo/Model/Post.php line: 959
PHP:
/**
* Adds the canInlineMod value to the provided post and returns the
* specific list of inline mod actions that are allowed on this post.
*
* @param array $post Post info
* @param array $thread Thread the post is in
* @param array $forum Forum the thread/post is in
* @param array|null $nodePermissions
* @param array|null $viewingUser
*
* @return array List of allowed inline mod actions, format: [action] => true
*/
public function addInlineModOptionToPost(array &$post, array $thread, array $forum, array $nodePermissions = null, array $viewingUser = null)
{
$this->standardizeViewingUserReferenceForNode($thread['node_id'], $viewingUser, $nodePermissions);
$postModOptions = array();
$canInlineMod = ($viewingUser['user_id'] && (
XenForo_Permission::hasContentPermission($nodePermissions, 'deleteAnyPost')
|| XenForo_Permission::hasContentPermission($nodePermissions, 'undelete')
|| XenForo_Permission::hasContentPermission($nodePermissions, 'approveUnapprove')
|| XenForo_Permission::hasContentPermission($nodePermissions, 'manageAnyThread')
));
if ($canInlineMod)
{
if ($this->canDeletePost($post, $thread, $forum, 'soft', $null, $nodePermissions, $viewingUser))
{
$postModOptions['delete'] = true;
}
if ($this->canUndeletePost($post, $thread, $forum, $null, $nodePermissions, $viewingUser))
{
$postModOptions['undelete'] = true;
}
if ($this->canApproveUnapprovePost($post, $thread, $forum, $null, $nodePermissions, $viewingUser))
{
$postModOptions['approve'] = true;
$postModOptions['unapprove'] = true;
}
if ($this->canMovePost($post, $thread, $forum, $null, $nodePermissions, $viewingUser))
{
$postModOptions['move'] = true;
}
if ($this->canCopyPost($post, $thread, $forum, $null, $nodePermissions, $viewingUser))
{
$postModOptions['copy'] = true;
}
if ($this->canMergePost($post, $thread, $forum, $null, $nodePermissions, $viewingUser))
{
$postModOptions['merge'] = true;
}
}
$post['canInlineMod'] = (count($postModOptions) > 0);
return $postModOptions;
}
what if I wanna add something like
Code:
if ($this->canDeleteRating($post, $thread, $forum, $null, $nodePermissions, $viewingUser))
{
$postModOptions['delete_rating'] = true;
}
to the method?
Should I create the whole method with the same name? does it replace the XenForo core codes?