The module works very well except for the " Delete associated term if a node is deleted". I thought maybe it had some incompatibility with Taxonomy Menu (that modules is still in somewhat iffy status), but no dice.

The use for this module is simple: Create a term in a Vocabulary using the node title as source. Creating and updating work fine.

In case that matters: The vocabulary used has not fields in the node form. It will only get its terms from the node from (add, delete, edit).

THanks

Comments

3rdLOF’s picture

Status: Active » Closed (won't fix)

Moved on to Rules.

capellic’s picture

Status: Closed (won't fix) » Active

Moved on to Rules.

What do you mean by that? I too have noticed this problem in alpha4. I have not tried DEV.

capellic’s picture

Status: Active » Needs review

Did some debugging on this and the code solution is quite simple. Basically, the code is trying to see if "Delete associated term if a node is deleted" is set for that content type. But, the $nat_config array is present at that point in the code. Looking at the examples in other functions were this setting is being used told me that I simply had to set the $nat_config array at the top of the nat_node_delete() function.

This is what the the function looked like before I made any edits:

/**
 * Implements hook_node_delete().
 */
function nat_node_delete($node) {
  if (_nat_check($node)) {
    // Deleting the associated term when a node is deleted is optional.
    if (isset($nat_config['delete'][$node->type])) {
      _nat_delete_terms($node->nid);
    }
    // Delete node-term association from the NAT table.
    _nat_delete_association($node->nid);
  }
}

This is the function after I added the call to load the $nat_config variable:

/**
 * Implements hook_node_delete().
 */
function nat_node_delete($node) {
  $nat_config = _nat_variable_get();
	
  if (_nat_check($node)) {
    // Deleting the associated term when a node is deleted is optional.
    if (isset($nat_config['delete'][$node->type])) {
      _nat_delete_terms($node->nid);
    }
    // Delete node-term association from the NAT table.
    _nat_delete_association($node->nid);
  }
}
Zen’s picture

Status: Needs review » Fixed

Fixed. Thanks!
-K

P.S. @capellic : http://drupal.org/patch

Status: Fixed » Closed (fixed)

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