I stumbled upon this while having 2 taxonomy fields from different vocabularies on the same content type; with save == 'tag'

While the taxonomy data is saved correctly in the taxonomy tables, when viewed each field's #view would show terms from both vocabs.

turned out content_taxonomy_terms_by_field() is not consulting (filtering by) vocab id (vid) and simply returns all terms for fields with depth == 1.

Attached patch does filtering in PHP, although a SQL-level filtering is an alternative.

CommentFileSizeAuthor
content_taxonomy_vid_error.patch528 bytesk8n

Comments

thepanz’s picture

maybe here: http://drupal.org/node/210824 you can find another solution

k8n’s picture

true. the solution is similar. let the maintainers decide.

yonailo’s picture

As the #1 comment says, this too can be done in SQL with the following query:

$result = db_query("SELECT n.tid FROM {term_hierarchy} h LEFT JOIN {term_node} n ON h.tid = n.tid LEFT JOIN {term_data} td ON n.tid = td.tid WHERE n.nid = %d AND h.parent = %d AND td.vid = %d", $node->nid, $parent, $vid);

inside content_taxonomy.module:content_taxonomy_terms_by_field()

yonailo’s picture

these patches will not solve the problem if you use two active select fields with the same vocabulary.

abhaga’s picture

After spending 2 days trying to figure out why my active select field was getting reset to arbitrary terms from an entirely different vocabulary, I also ended up on the same bug. Using the above patch solves the problem.

This should be fixed asap.

magnus’s picture

Status: Needs review » 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.