Hello,
Just upgraded to 7.x-11 from 7.x1.0-beta2 and noticed that Ajax Comments weren't working in my Forums, which use the Advanced Forum module.
The error being thrown from line 13 of ajax_comments.js was TypeError resulting in the console with 'ajaxComments-ScrollToElementError: TypeError'
I figured out that the jQuery dom element needed to attach the ajax comment form to was not being found by Ajax Comment. The comment container of Advanced Forum comments is missing the 'comment-wrapper-MYCID' class selector. You can insert it by adding it to the classes array on line 29 of Advanced Forum module's 'advanced_forum_preprocess_comment.inc'. You first need to grab each comment's CID value by assigning a var like $comment_cid = &$variables['elements']['#comment']->cid. Then on line 29 add comment-wrapper-'.$comment_cid.' to $variables['classes_array'][] array.
Until you guys adapt to Advanced Forum this is a quick fix to Advanced Forum, where I'll also add it as an issue.
best
Comments
Comment #1
Samlet9908 CreditAttribution: Samlet9908 commentedComment #2
formatC'vt CreditAttribution: formatC'vt commentedhm, maybe they are rewrite a comment classes. i will check this today.
Comment #3
formatC'vt CreditAttribution: formatC'vt commentedi'm already provide patch for advanced forum #2174655: Keep default classes from Drupal core comments
use option "Keep default CSS classes (For experts only)." in
admin/config/content/advanced-forum
Comment #4
Revathi.M CreditAttribution: Revathi.M commentedi am also having the same issue the comment wraper class is missing.for the initial execution.then i have added the ajax-comment-wraper class by custom js code.now it is working fine
Comment #5
formatC'vt CreditAttribution: formatC'vt commentedcomment wrapper class is important, without this class we can't know about where is right place for comments on the page.
Comment #6
ankitgupta13 CreditAttribution: ankitgupta13 commentedwhich place i need to include the code for add wrapper class
Or what is the custom js code
Comment #7
ankitgupta13 CreditAttribution: ankitgupta13 commentedComment #8
formatC'vt CreditAttribution: formatC'vt commentedusually wrapper class located in
comment-wrapper.tpl.php
Comment #9
savioret CreditAttribution: savioret commentedWhat I found using version 7.x-1.3:
Keep default CSS classes
enabled, otherwise the class comment-wrapper-nid-XXX does not exist as it is overwritten.comment-wrapper-nid-12345 > .ajax-comment-wrapper:last
which in many cases (as in mine) there is more nesting levels in between. I am using a custom template and I need an extra level.I'm not sure if the solution is as simple as removing the restriction
.comment-wrapper-nid-12345 .ajax-comment-wrapper:last
but it seems to work for me.