I installed Node Comments module and the built in comments module has been turned off.
Now the AJAX Comments is not working.

Does anybody have an idea how to fix the problem
And does abybody know in which module the problem exist ?

Comments

neochief’s picture

Status: Active » Postponed

The problem is in the fact that Node Comments have different implementation than the standard comments module, and ajax_comment currently even not trying to hook-in into node_comments. I can't say when this compatibility will be solved, as it is not in middle priority right now.

eidolon night’s picture

The new nodecomments module allows you to choose whether to use nodecomments or Drupal comments for each content type. I'm currently only using nodecomments in the forums (with drubb). Is there any way to disable ajax comments for certain content types? Maybe a check to only use ajax comments when not using nodecomments.

function comment_bonus_api_menu_alter(&$items) {
  $items['node/%node'] = array(
    'title callback' => 'node_page_title',
    'title arguments' => array(1),
    'page callback' => 'comment_bonus_api_node_page_view',
    'page arguments' => array(1),
    'access callback' => 'node_access',
    'access arguments' => array('view', 1),
    'type' => MENU_CALLBACK
  );
  return $items;
}

The above is the issue. It's located in comment_bonus_api.module What I'd like to do is only execute the function for the node types for which AJAX comments has been enabled.

izmeez’s picture

subscribing

Fidelix’s picture

subscribing

darthf1’s picture

Subscribing. I would like to see compatibility with Node Comments, as Node Comments is going to be the standard in the new version of Advanced Forum.

ltwinner’s picture

subscribing, node comments + ajax comments = great combination for drupal

imDhaval’s picture

Status: Postponed » Needs work

sub+

rjbrown99’s picture

Project: AJAX Comments » Comment Bonus API
Assigned: tommytom » Unassigned
Status: Needs work » Active

You can set ajax_comments up to only be enabled for different content types. It's part of the administration UI under Site Configuration -> Ajax Comments -> Content Types.

It sounds like this is more closely related to comments_bonus_api, so I am moving it there. It is also related to the issue raised in #672722: Add compatibility with panels since we're talking about the same overridden menu path.

I'm not using those modules personally so I am not going to be able to help beyond reviewing patches that are submitted by others.

webviper’s picture

I created a small hack that lets ajax comments and node comments work in conjunction with each other. I'll see if I can dig it up when I get home and post it up here.

rjbrown99’s picture

#9: Thank you. If it's a workable solution for the issue I'm certainly open to having it reviewed for inclusion in the module. There seems to be some interest in this issue.

webviper’s picture

Oops, forgot about this topic. Here's the code -

<?php
/**
 * AJAX comments and nodecomments are incompatible because they both
 * override the menu item for node/%node
 * To fix this override node/node% and call the correct page callback
 * dependant on the node type.
 * Forum nodes page callback - nodecomment_node_view
 * All other nodes page callback - comment_bonus_api_node_page_view
 */
function mymodule_menu_alter(&$items) {
  $items['node/%node']['page callback'] = 'mymodule_node_view';

  $comment_types = nodecomment_get_comment_types();
  foreach (node_get_types('names') as $type => $blank) {
    $path = "node/add/". str_replace('_', '-', $type);

    if (isset($items[$path])) {
      // Attach custom access callback that ensures proper access denied page
      // when adding node comments directly.
      $items[$path]['access callback'] = '_nodecomment_node_add_access';

      // Make all our comment types not visible to node/add.
      if (in_array($type, $comment_types)) {
        $items[$path]['type'] = MENU_CALLBACK;
      }
    }
  } 
}

/**
 * Call the correct function depending on node type
 */
function mymodule_node_view($node, $cid = NULL){
  // Call the nodecomment page callback
  if ($node->type == 'forum'){
    return nodecomment_node_view($node, $cid);
  }
  else{
    return comment_bonus_api_node_page_view($node, $cid);
  }
}
?>
davethedruper’s picture

This might be a stupid question but what file do you put this code into?

webviper’s picture

You need to create a module, put that code into it and then enable it.

light9’s picture

On, my installation (6.19) it is not working. comment-wrapper.tpl.php still rendering through nodecomment_node_view instead comment_bonus_api. I use ajax_comments + comment_bonus_api.

rjbrown99’s picture

Status: Active » Fixed

Looks like the answer is in #11.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.