Archived : Techno Babble

This is the archived version of my b2evolution code blog.
If you require any help regarding b2evolution then
visit it's support forums

You can find my current blogs here
Code : {@link : WafflesOn}
Personal : {@link : InnerVisions}

« Playing with cloudsPlaying with nested comments »

Nested comments

Posted on 11th Mar 2007 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 CommentList0implode(','$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_commentNULL ) )
            {
                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 ;)
¥

29 comments

Comment by Gary on 12/03/07
Nice work, but what does it actualy do ? :oops:

What should we do with spammers? You want to play with them
Comment by ¥åßßå on 12/03/07
It means that if you click "reply to Yabba" and then make a comment it'll "subset" it below the comment that you are replying to ;)

¥

What should we do with spammers? You want to play with them
Comment by Gary { @link http://garysblog.co.uk } on 12/03/07
Cool, I will have a look now by posting a comment.

Gz

What should we do with spammers? You want to play with them
Comment by ¥åßßå on 12/03/07
Of course, it helps if you click the "reply to" link ;)

¥

What should we do with spammers? You want to play with them
Comment by Gary { @link http://garysblog.co.uk } on 12/03/07
I could of sworn that I did :)

What should we do with spammers? You want to play with them
Comment by we on 24/07/07
prova

What should we do with spammers? You want to play with them
Comment by we on 24/07/07
prova2

What should we do with spammers? You want to play with them
Comment by Troy { @link http://freesite.iblogger.org } on 31/08/07
Just testing what nested comments look like :)

What should we do with spammers? You want to play with them
Comment by JC John SESE Cuneta { @link http://gameshogun.ws/ } on 16/09/07
Can't wait to get this upgraded for b2evo-v2 :p



What should we do with spammers? You want to play with them
Comment by ¥åßßå on 16/09/07
I assume that means it doesn't work in 2.0 :p

¥

What should we do with spammers? You want to play with them
Comment by JC John SESE Cuneta { @link http://gameshogun.ws/ } on 16/09/07
Haven't tested actually. Most of the v1.x plugins I tried is not working for v2a1, or is not working 100% as was intended.. So I marked all plugins not to work for v2 :p hehe.. especially since 'nothing is final' yet.

^_^

Har.. it's 11pm here, Monday again tomorrow.. back to day job :/



What should we do with spammers? You want to Burn them! They're witches and warlocks!!
Comment by ¥åßßå on 16/09/07
Give it another 7 hours and I'll be in the same position ;)

btw, I noticed the following error on your blog ( top right corner )

Notice: Array to string conversion in /[path]/inc/_core/_misc.funcs.php on line 298
Array



¥

What should we do with spammers? You want to play with them
Comment by dave { @link http://www.mindfulmission.com } on 15/10/07
hey... so I installed the plugin, but I am having problems.

when i go to enter a new comment, it inserts it as a nested comment instead of starting a new comment thread on the post.

any help would be appreciated...
Comment by ¥åßßå on 15/10/07
Hi Dave,

The only problem I know of with the plugin at present is if you're running b2evo 2.0.x and preview your comment ( the plugin currently "forgets" the nesting )

You shouldn't be having problems with 1.10.2. The comments should only get nested if you click "reply to aaaaaa", if you just fill in the comment box and press send then it ends up un-nested ( like yours is on this thread )

¥
Comment by Lurker on 15/10/07
The comments should only get nested if you click "reply to aaaaaa", if you just fill in the comment box and press send then it ends up un-nested ( like yours is on this thread )

hmmm... i think it has something to do with the spacing in the "bcomment" code that does the indentation. it is placing the comments in the correct place in terms of order, but it keeps indenting them further in even if I start a new thread.

you can see an example here.

any ideas?

thanks for the help.
Comment by ¥åßßå on 15/10/07
Hi Dave,
Without sounding funny, if you cure the validation errors on your website then you'll probably find this works as planned.

If you still have a problem after that ( or if you need help with curing them ) then just give me a shout ;)

¥
Comment by dave { @link http://www.mindfulmission.com } on 15/10/07
You weren't sounding funny... I know that some my code sucks right now.

So I went back and fixed the validation errors... but that didn't work. Then my b2e guru Danny told me that the feedback form had probably been changed since I edited mine, and to get a new feedback.php and re-edit it. And that worked.

So it is all better now - thanks!
Comment by AKGBob { @link http://www.leenaeats.com } on 16/01/08
Does this send the original poster a reply when someone "Replies to" them?
Comment by Evil AKGBob on 16/01/08
Just testing
Comment by Super Evil AKGBob on 16/01/08
Ha - sorry, just saw the tic box. By ticking the box, do you get all replies to the post or only reply's to your comment?
Comment by ¥åßßå on 16/01/08
You should get all replies to the post ;)

¥
Comment by Pandu E Poluan { @link http://pandu.poluan.info/blog/ } on 04/04/08
Will this be updated for b2evo 2.x ?
Comment by ¥åßßå on 04/04/08
This blog runs 2.x ;)

¥
Comment by Pandu E Poluan { @link http://pandu.poluan.info/blog/en/ } on 04/04/08
Ah, I see.

So the stupidity is mine and mine alone :oops:
Comment by Pandu E Poluan { @link http://pandu.poluan.info/blog/ } on 08/04/08
Help! :(

This plugin emitted the following error on my blog:

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

I'm using the latest b2evo, btw.
Comment by ¥åßßå on 09/04/08
Line 108 is a blank line, so it's a smidge hard to get an error there, but based on the area of the plugin code that you're having the error I'd guess that you have the 1st piece of code in the wrong place.

¥
Comment by tester on 08/09/08
testing ...
Comment by ¥åßßå on 09/09/08
It works huh? ;)

¥
Comment by tilqicom on 13/10/08
more test
Page archived : 2nd Mar 2010
 

X