Only fill this in if you're a spammer huh? Your name :
Your email :
Your message :

Archives for: March 2007

Mar
11th
2007

Nested comments

Posted in : Plugins & Widgets

I finally found the time to finish off the nested comments plugin. If you fancy having a pre-release play with it you can find it here. Please note : it has a known problem - when you preview a comment it "forgets" which comment it's a reply to. This is caused by the fact that the core redirects through htsrv when creating a preview and doesn't pass on the plugins parameter. I'm working on it ;) *solved : zip file update 12th March*

Unlike most of our plugins this one also involves some code in your skins _feedback.php, not a lot though so don't worry. First find this segment of code and add the new bit :-

Code:

<?php
  $CommentList = & new CommentList( 0, implode(',', $type_list), array('published'), $Item->ID, '', 'ASC' );
  // Nested comments part 1 of 3

Code:

<?php
      // Nested comments part 2 of 3
      if ( $Item->can_comment( NULL ) )
      {
        echo '<p class="replyTo"><a href="'.url_add_param( $Item->get_permanent_url(), 'am_nestCmnt_reply_to='.$Comment->ID ).'#bComment_form_id_'.$Item->ID.'">Reply to <span>comment '.$Comment->ID.' by </span>'.$Comment->get_author_name().'</a></p>';
      }
      ?>

The final bit of code is just a demonstration of how to use the comment depth to indent your comments

Code:

// Nested comments part 3 of 3
    <div class="bComment"<?php echo ( isset( $Comment->depth ) ? ' style="margin-left:'.( $Comment->depth * 2).'em"' : '' );?>>

And that's pretty much it. The plugin should work in all 1.8.x and 1.9.x versions, let me know if you manage to break it ;)
¥

2151 views and only 26 comments
Top ways you found my blog