• Resolved fusse

    (@fusse)


    The plugin is working almost as it should…or it probably is but something wrong with my conf. I’m using callback function which is pretty much the same as the example in the twentyten theme functions.php.

    But for some reason when replying to a comment the reply doesn’t get the proper classes (depth-2 etc.) and therefore renders as it was the depth-1 comment (gets those classes). After page refresh it does render correctly as depth-2.

    If I disable the callback, then the class is set properly so my guess is that this has something to do with the callback function and how it’s set up but I can’t figure it out… Or could it be something else?

    https://www.ads-software.com/extend/plugins/ptm-ajax-comments/

Viewing 15 replies - 1 through 15 (of 25 total)
  • 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;
    Thread Starter fusse

    (@fusse)

    Tried. No change.

    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.

    Plugin Author Pete

    (@swisswp)

    Try this:

    1. get https://gist.github.com/2300355 and replace the file ptm-ajax-comments.dev.js in the plugins js directory
    2. go to the plugin options page -> Support -> Developer JS -> check = on
    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! ??

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘[Plugin: PTM AJAX Comments] threaded comment not getting the correct css class (depth)’ is closed to new replies.