Yahoo Terms clears contents of $node->taxonomy when yahoo_terms_enable_runtime is YAHOO_TERMS_ON_NODE_CREATION_AND_UPDATE
bangpound - August 24, 2007 - 13:03
| Project: | Yahoo Terms |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I have two free tagging taxonomies for my content type. When I have Yahoo Terms set to get terms whenever a node is created and updated, the taxonomy variable of the node is cleared when the node is edited. It must have something to do with these lines in yahoo_terms_nodeapi:
case 'prepare':
$automatic = variable_get('yahoo_terms_enable_runtime', YAHOO_TERMS_ONLY_MANUALLY);
if ($automatic == YAHOO_TERMS_ON_NODE_CREATION_AND_UPDATE && isset($node->nid)) {
$node->taxonomy = array();
}
break;When the node form is being prepared, it will always clear the contents of the taxonomy if the node already exists and if the yahoo_terms_enable_runtime is set to creation and update. Shouldn't it only clear the terms associated with the vocabulary where Yahoo Terms go?

#1
I fixed my issue with this patch:
case 'prepare':$automatic = variable_get('yahoo_terms_enable_runtime', YAHOO_TERMS_ONLY_MANUALLY);
if ($automatic == YAHOO_TERMS_ON_NODE_CREATION_AND_UPDATE && isset($node->nid)) {
$vid = _yahoo_terms_which_vocab($node->type);
foreach ($node->taxonomy as $tid => $term) {
if ($term->vid == $vid) {
unset($node->taxonomy[$tid]);
}
}
}
break;
#2
i had the same issue in drupal 6. the fix works here as well