Hi,
in my case I have some problems with the function "nodecomment_nodeapi".

The case load is fired before the insert case is fired. This writes an error into watchdog, because the node isn't saved yet. What could be the reason for it?

Cheers KRav

Comments

Apfel007’s picture

Title: node comment with ctools » node comment with image field - error Node xx is configured as comment, but the comment ...
Category: task » bug

I reproduced this error:

"Node 913 is configured as comment, but the comment ..."

It seems that the image field in my comment causes this error. I deleted the field an the error was gone.

The problem seems to be in the case "load" - it is fired before node_comment_save is fired.

/**
 * Implementation of hook_nodeapi().
 */
function nodecomment_nodeapi(&$node, $op, $arg = 0, $page = 0) {
  switch ($op) {
   
      
    case 'presave':
      // Restore comment setting so that we don't disable commenting
      // accidentally.
      if (isset($node->node_comment)) {
        // Allow changing of comment setting during node form submission.
        if (!isset($node->nodecomment_real_node_form)) {
          $node->comment = $node->node_comment;
        }
      }
      break;

    case 'insert':
    case 'update':
      // If this is a comment, save comment data.
      if (isset($node->comment_target_nid)) {
        nodecomment_save($node);
      }
      break;

    case 'load':
  
      return _nodecomment_nodeapi_load($node, $op, $arg, $page);
    
      break;