Recent Topics

1 Jul 17, 2008 23:15    

I tried to follow the instructions here:

http://waffleson.co.uk/2007/03/nested_comments

But I really got confused with where to put the two lines:

// Nested comments part 1 of 3
$Plugins->call_by_code( 'amNestCmnt', array() );

I am using the Russian b2evo Theme

What I've done:
[list]

  • Copied the file "_item_feedback.inc.php" to the "b2evo_ru" directory

  • Opened "_item_feedback.inc.php" and inserted the above code to line 158

  • [/list:u]

    Now I got the following error:

    Notice: Trying to get property of non-object in /home/poluani/public_html/pandu/blog/plugins/am_nested_comments_plugin/_am_nested_comments.plugin.php on line 108

    Here's the page that shows the error:

    http://pandu.poluan.info/blog/optimizer-id.php/placeholder-posting?page=2

    FYI, line 108 in the _am_nested_comments.plugin.php is:

    
    if( !( $evoComments = $CommentList->result_num_rows ) ) return;	// there are no comments
    

    Any help would be greatly appreciated.

    2 Jul 22, 2008 18:36

    No suggestion?

    Gee... I guess Nested Comments is beyond b2evo's capabilities then. Oh well...

    3 Jul 22, 2008 20:16

    Hi pepolun,

    If you can wait until I have a chance to install a demo blog && the ru skin then I'll offer you a work through.

    The post you linked to hasn't been updated to reflect the current evo skins way of doing things, but if you check the comments on my blog you can see it works .... unfortunately I have a pretty unique skin, so my code changes won't work in yours

    ¥

    4 Jul 22, 2008 21:19

    I tried to install nested comments. There is no depth in Comment object

    5 Jul 23, 2008 00:15

    The plugin creates the depth property ;)

    ¥

    6 Jul 23, 2008 00:20

    var_export($Comment);

    Comment::__set_state(array(
       'Item' => NULL,
       'item_ID' => '22',
       'author_User' => NULL,
       'author_ID' => NULL,
       'type' => 'comment',
       'status' => 'published',
       'author' => NULL,
       'author_email' => NULL,
       'author_url' => '',
       'author_IP' => '127.0.0.1',
       'date' => '2008-07-22 14:39:51',
       'content' => 'thhhhhhhhhhhhhhhhhhhh',
       'spam_karma' => NULL,
       'allow_msgform' => '0',
       'nofollow' => '1',
       'ID' => '3',
       'dbtablename' => 'T_comments',
       'dbprefix' => 'comment_',
       'dbIDname' => 'comment_ID',
       'datecreated_field' => '',
       'datemodified_field' => '',
       'creator_field' => '',
       'lasteditor_field' => '',
       'dbchanges' => 
      array (
      ),
       'delete_restrictions' => 
      array (
      ),
       'delete_cascades' => 
      array (
      ),
       'author_user_ID' => '1',
       'rating' => NULL,
       'featured' => '0',
    ))

    7 Jul 23, 2008 00:34

    Here is a quick patch

    replace

    $Plugins->call_by_code( 'amNestCmnt', array() );


    with

    $Plugins->call_by_code( 'amNestCmnt', array( 'CommentList' => $CommentList ) );

    and in plugin

    function SkinTag()
    {
    	global $CommentList, $DB;

    to

    function SkinTag( & $param )
    {
    	global $CommentList, $DB;
    	
    	$CommentList = $param['CommentList'];

    9 Jul 23, 2008 01:20

    function SkinTag( & $params )
    	{
    		global $DB;
    		$this->CommentList = & $params[ 'CommentList' ];
    		if( !( $evoComments = $this->CommentList->result_num_rows ) ) return;	// there are no comments
    
    		// lets set all the parents and depths
    		for( $z = 0; $z < $evoComments; $z++ )
    		{
    			$sql = 'select comment_parent, comment_depth from '.$this->get_sql_table('nesting').' where comment_ID = '.$this->CommentList->Obj[ $z ]->ID;
    			$fred = $DB->get_results( $sql );
    
    			if( empty( $fred[0]->comment_parent ) ) $fred[0]->comment_parent = $this->CommentList->Obj[ $z ]->ID;
    			if( empty( $fred[0]->comment_depth ) ) $fred[0]->comment_depth = 0;
    			$this->CommentList->Obj[ $z ]->parent = $fred[0]->comment_parent;
    			$this->CommentList->Obj[ $z ]->depth = $fred[0]->comment_depth;
    		}

    the plugin sets the depth and parent properties ;)

    Your patch is very close to what's in my skin :P

    	$CommentList = & new CommentList( NULL, implode(',', $type_list), array('published'), $Item->ID, '', 'ASC' );
    
      // Nested comments part 1 of 3
    	$Plugins->call_by_code( 'amNestCmnt', array( 'CommentList' => & $CommentList ) );

    See first "paste" for the skintag change ;)

    Guess I need to update the download as well as the instructions :P

    ¥

    *edit*
    If you download the version from my credits page ( [url=http://waffleson.co.uk/2007/10/credits]credits[/url] ), then you'll have the code as it is now on my blog

    10 Jul 23, 2008 01:31

    I always forget about this reference thing &

    I deleted the plugin from download and fixed _item_feedback.inc.php

    11 Jul 23, 2008 01:37

    I always forget to update zips :-S

    I'll have to remember to post a 2.x.x version of the instructions though ... lots has happened since then

    ¥


    Form is loading...