It appears that the taxonomy field has a conflict with the taxonomy_defaults module. taxonomy_defaults automatically associates a default taxonomy with a node whenever a new node is created. It works fine, except when the content type contains a taxonomy field.

The way that taxonomy_defaults appears to work is that it overrides the nodeapi method and simply sets a default taxonomy in the $node->taxonomy. I am guessing that this is done before content taxonomy is called, which wipes out the previously set taxonomy.

I'd imagine this is a quick fix? Let me know what you find.

Comments

ilmaestro’s picture

Ok, the issue is occuring in content_taxonomy.module in the content_taxonomy_field method:

    case 'submit': 
      global $content_taxonomy_array_cleared;
      if (!is_array($content_taxonomy_array_cleared) || !$content_taxonomy_array_cleared[$node->nid]) {
        unset($node->taxonomy);   // The problem is here!!!
        $content_taxonomy_array_cleared[$node->nid] = true;
      }

So what is the purpose of that bit of code? Why are we unsetting all previous taxonomy for the node?

alexh’s picture

Hi,
I had the same problem and it seems to be solved like that:

Remove or comment out the unset in the function content_taxonomy_field in content_taxonomy.module:

    case 'submit': 
      global $content_taxonomy_array_cleared;
      if (!is_array($content_taxonomy_array_cleared) || !$content_taxonomy_array_cleared[$node->nid]) {
        #remove this: unset($node->taxonomy);
        $content_taxonomy_array_cleared[$node->nid] = true;

...and change the function taxonomy_defaults_nodeapi in taxonomy_defaults.module:

function taxonomy_defaults_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if ($op == 'submit') {
    $taxonomy = $node->taxonomy;
    $type_vocabularies = taxonomy_get_vocabularies($node->type);
    foreach (taxonomy_get_vocabularies() as $vid => $vocab) {
      $activevocab = array_key_exists($vid, $type_vocabularies);
      // Active vocabs have been inserted via the form already and may have been modified by the user
      if (!$activevocab && variable_get("taxdef_{$node->type}_{$vid}_active", FALSE)) {
        $default_tids = variable_get("taxdef_{$node->type}_{$vid}", array());
#change this:        $taxonomy[$vid] = $vocab->multiple ? $default_tids : $default_tids[0];
#to this:
        $taxonomy[$vid] = $vocab->multiple ? $default_tids : array($default_tids[0] => $default_tids[0]);
      }
    }
    if (isset($taxonomy)) {
      $node->taxonomy = $taxonomy;
    }
  }
}
dynv’s picture

I'm having this issue as well. It would be nice to have something committed so I would be able to combine both module as I would prefer.

internal’s picture

Subscribing...

momper’s picture

subscribe

ttaylor797’s picture

I had the same issue with taxonomy terms not taking to the db post submit, and only had to change the content_taxonomy.module line 126 as per #2.

Thanks Alexh!

hapydoyzer’s picture

subscribing

magnus’s picture

Status: Active » Closed (won't fix)

Cleanup of old issues. According to maintainer: "active development is only done for the 6.x branch! 5.x is not supported any more".
Open a new issue if problem still exist.