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 :-
PHP:
<?php | |
$CommentList = & new CommentList( 0, implode(',', $type_list), array('published'), $Item->ID, '', 'ASC' ); | |
<span style="color:red">// Nested comments part 1 of 3</span> | |
<span style="color:red">$Plugins->call_by_code( 'amNestCmnt', array() );</span> |
The next piece of code can go anywhere in the comment loop and will spit out a "reply to this comment" link
PHP:
<?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
PHP:
// Nested comments part 3 of 3 | |
<div class="bComment"<span style="color:red"><?php echo ( isset( $Comment->depth ) ? ' style="margin-left:'.( $Comment->depth * 2).'em"' : '' );?></span>> |
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 ![]()
¥
Trackback URL (right click and copy shortcut/link location)
Trackback url for this post
Note : This trackback url is time limited so use it within 30 minutes or the SpamHound will snarl at you.
http://waffleson.co.uk/z/?k=36412602633103238a87a669bdb59219250534bb823c8dde6
Reply to comment 13908 by Gary