Plugin Author
Pete
(@swisswp)
Hi fusse, could you post the source of both comments.php & your callback function to either Pastebin or Gist and add the links here so I can have a look?
Thread Starter
fusse
(@fusse)
Plugin Author
Pete
(@swisswp)
Changed line 7 in functions.php: https://gist.github.com/2299483
Thread Starter
fusse
(@fusse)
Yea I had it like that before and forgot to change it back. (I tried that to see if it had any effect but it didn’t work).
So anyway, the change you made doesn’t affect the outcome at all. I can’t figure it out but the problem is that the reply is not getting the correct class. Don’t know why though…
Plugin Author
Pete
(@swisswp)
Strange, let me dig into this, maybe I’ll see something.
Thread Starter
fusse
(@fusse)
Thanks! Like I said in the beginning, if I disable the callback from the plugin options and make it use the wordpress default list comments (also disable the callback in comments.php), it will set the correct class and the reply message will be indented but then it of course looks wrong otherwise as it has different html layout.
Plugin Author
Pete
(@swisswp)
Edited: https://gist.github.com/2299483#file_functions.php
- removed select/case/break statements
- removed $GLOBALS[‘comment_depth’] = $depth;
Plugin Author
Pete
(@swisswp)
Does the comment get added at the correct position?
Thread Starter
fusse
(@fusse)
Yes. Everything else is as it should apart from the class issue (not getting the depth-2 but depth-1). And page reload fixes this: so the data put to database is correct.
Plugin Author
Pete
(@swisswp)
Found it. It’s a bug in the plugin. Do not expect a fix today. š
(The added comment gets processed by the Walker_Comment class. Since its the only comment in the comments array, the $depth returned is always 1)
Thread Starter
fusse
(@fusse)
Okay nice! Thanks. I didn’t take too much time to look into the plugin itself. I guess, since the official fix ain’t coming soon, I will take a look myself and try to fix it.
Thread Starter
fusse
(@fusse)
I managed to fix my issue with replacing the depth-1 with depth-2 in the tmpComment – kinda what you did in your example but I did it here:
if(jQuery(‘#’+css_respond).parent().children(‘.children’).length) {
// There are replies, add comment to the end of the list
tmpComment = data.replace( ‘depth-1’, ‘depth-2’ );
and here:
tmpComment = data.replace( ‘depth-1’, ‘depth-2’ );
tmpComment = ‘<ul class=”children”>’+tmpComment+”;
I only use depth-2 and no deeper so it works for me. Now I just need to replace/strip away the Reply link from tmpComment depth-2 comment as that doesn’t apply to my site.
I tried your fix though and noticed that it doesn’t quite work still: when replying to first level comment, if there are replies that are depth-2 already, the reply gets depth-3 instead of depth-2 which it should be getting as it was a reply to the original depth-1 comment.
Plugin Author
Pete
(@swisswp)
Now I just need to replace/strip away the Reply link from tmpComment depth-2 comment as that doesn’t apply to my site.
Settings -> Discussion -> Enable threaded (nested) comments X levels deep | set X to 2 and the reply links will be gone.
Glad you found your own solution to the bug. I will work on mine and add it to the next update.
Thanks for pointing it out! š