I tried searching for this issue, and sorry if I missed something.
I have a node type with two taxonomies with overlapping terms.
Vocabulary 6 - uses community tags, thousands of free text terms
Vocabulary 11 - controlled vocabulary, also with thousands of terms
When I add a term on the community tags form for vocabulary 6 where a term of the same name exists already in vocabulary 11, the term shows up on the screen then disappears. When I look in the database, I can see that the community tags table has assigned the term from the wrong vocabulary.
mysql> select * from community_tags where nid=258030;
+-------+--------+-----+------------+
| tid | nid | uid | date |
+-------+--------+-----+------------+
| 59819 | 258030 | 1 | 1312403217 |
| 64144 | 258030 | 1 | 1312403241 |
+-------+--------+-----+------------+
2 rows in set (0.00 sec)
mysql> select * from term_data where tid=59819;
+-------+-----+---------+-------------+--------+
| tid | vid | name | description | weight |
+-------+-----+---------+-------------+--------+
| 59819 | 11 | Stayton | | 0 |
+-------+-----+---------+-------------+--------+
1 row in set (0.00 sec)
mysql> select * from term_data where tid=64144;
+-------+-----+-----------+-------------+--------+
| tid | vid | name | description | weight |
+-------+-----+-----------+-------------+--------+
| 64144 | 6 | cannibals | | 0 |
+-------+-----+-----------+-------------+--------+
1 row in set (0.00 sec)
I can't tell at all where this is happening or why.
What I expect to happen instead is that when I use a tag that matches a term in a not-community-tags vocabulary, a new term will be created in the community tags vocabulary.
Comments
Comment #1
calebtr commentedI found where the error was happening, in the community_tags.module function _community_tags_node_process_tags_and_terms, line 1138:
When I added a tag that existed as a term in the non-ct vocabulary, but not in the ct vocabulary, Drupal's taxonomy_get_term_by_name was returning an array of the one non-ct-vocabulary term.
Community tags then checks to see if the vid is correct, and if it is, breaks the for loop. If it isn't, nothing happens, leaving the
$matching_termvariable set to the last item in the array - in this case, my term from the wrong vocabulary.To fix this I added, after the check for the vocabulary id:
I'd like to make a patch, but am getting some really strange things from git right now.
Comment #2
rexcn commentedhave the same problem, thx for help.
Comment #3
chaps2 commentedThanks for reporting and for the fix! Andy