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

Samlet9908’s picture

Issue summary: View changes
formatC'vt’s picture

hm, maybe they are rewrite a comment classes. i will check this today.

formatC'vt’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: -advanced forum

i'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

Revathi.M’s picture

i 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

formatC'vt’s picture

comment wrapper class is important, without this class we can't know about where is right place for comments on the page.

ankitgupta13’s picture

which place i need to include the code for add wrapper class

Or what is the custom js code

ankitgupta13’s picture

Status: Postponed (maintainer needs more info) » Active
formatC'vt’s picture

usually wrapper class located in comment-wrapper.tpl.php

savioret’s picture

What I found using version 7.x-1.3:

  • Advanced forum needs to set the option Keep default CSS classes enabled, otherwise the class comment-wrapper-nid-XXX does not exist as it is overwritten
  • The ajax css selector used in the command for inserting new comments in the response callback is assuming that there is only one level between comment-wrapper and ajax-comment-wrapper, this is for example .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.