how extends class

Hugilore111

Member
hello!
how extends class
example:
Code:
<?php
class Display_Model_Post extends XFCP_Display_Model_Post
{
    public function preparePost(array $post, array $thread,array $forum, array $nodePermissions = null, array $viewingUser = null)
    {
      
            parent::preparePost(array $post, array $thread,array $forum, array $nodePermissions = null, array $viewingUser = null);
   
    }
  
   
  
}

I receive an error
Parse error: syntax error, unexpected '$post' (T_VARIABLE), expecting '(' in C:\xampp\htdocs\xd\library\Display\Model\Post.php on line 7
 
Thanks Chris
Wrong again.
what am I doing wrong?
Server Error
Argument 1 passed to XenForo_Model_Post:PreparePost() must be of the type array, none given, called in C:\xampp\htdocs\xd\library\Display\Model\Post.php on line 7 and defined
 
Thanks Chris
Wrong again.
what am I doing wrong?
Server Error
Argument 1 passed to XenForo_Model_Post:preparePost() must be of the type array, none given, called in C:\xampp\htdocs\xd\library\Display\Model\Post.php on line 7 and defined
You didn't actually post what your edited call now looks like. But this is what it should look like:
Code:
parent::preparePost($post, $thread, $forum, $nodePermissions, $viewingUser);

and one thing you're overlooking is that XenForo_Model_Post::preparePost returns a value. So depending on what you're trying to do exactly, you might want to do this:

Code:
$retVal = parent::preparePost($post, $thread, $forum, $nodePermissions, $viewingUser);
*do my own stuff here*
return $retVal;

If you don't, whatever function is calling preparePost won't get the expected return from it.
 
Top Bottom