Download & Extend

yahoo_terms does not operate as expected when used with free-tag vocabularies.

Project:Yahoo Terms
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

had to make a number of modifications to yahoo_terms_node_assign_keywords in order to accommodate a free-tag vocabulary that would allow user-entered tags to co-exist with yahoo_terms. Haven't done extensive testing with these modifications for nodes that have multiple vocabs: in theory, the code should still work, even if the vocabulary in question is not a tags type vocab.

People using this functionality will probably also want to remove the 'prepare' branch in the yahoo_terms_nodeapi function -- it clears out all taxonomy for the node; for free-tagging, you want this to remain, otherwise user-generated tags are not visible/lost.

Not sure what this does in situations where terms are not reset on update -- again, haven't done extensive testing. hopefully this will still be useful for somebody.

<?php
function yahoo_terms_node_assign_keywords(&$node, $query = "", $blacklist, $vid, $static = FALSE) {
 
$text = $node->body;
 
$limit = variable_get('yahoo_terms_taxonomy_limit_for_'. $node->type, FALSE);
 
$limit = ($limit === FALSE) ? variable_get('yahoo_terms_taxonomy_limit', -1) : $limit;
 
$terms = yahoo_terms_text_get_keywords($text, $query, $limit, $blacklist);
  if (isset(
$node->taxonomy['tags'][$vid])) { //if free-tagged, only process 'new' yahoo tags.
 
$existing_tags=array();
 
$existing_tags=array_map('trim',explode(",",$node->taxonomy['tags'][$vid])); //trim is ok (and necessary!!!!) because we know it's 1-dim
 
$terms= array_diff($terms,$existing_tags);
  }
  if (!empty(
$terms)) {
 
$tids_fetched = _yahoo_terms_create_vocabulary_items($terms, $vid, $static);
  }
  else {
  
$tids_fetched=array();
  }
 
$tids_in_node = $node->taxonomy;
 
$tids_now = $tids_in_node + $tids_fetched;
 
taxonomy_node_save($node->nid, $tids_now);
}
?>

Comments

#1

Can you please provide a patch for this?

#2

Status:active» closed (won't fix)

closing very old issue -- feel free to re-open if it's still a problem