I need another way of term manipulation. I want to replace a term or more for a node but there are allready terms from other vocabularies assinged. I don't want to kick them, I just want to delete all term of the vocabulary and add the new term.

For example: i use taxonomy for navigation and now i want to move some nodes from one category to another.

I allready realized that feature. I added the following to the function 'taxonomy_action' in taxonomy_action.inc
at line 6

define('TAXONOMY_ACTION_REPLACE_IN_VOC', 3);

at line 19:

 // check for replace inside vocabulary
  if ($context['do'] == TAXONOMY_ACTION_REPLACE_IN_VOC) {
    $existing_terms = taxonomy_node_get_terms($node);
    // delete terms in voc    
    foreach($existing_terms as $existing_term) {
        foreach($terms as $term) {
            if ($term->vid == $existing_term->vid) {
                unset($existing_terms[$existing_term->tid]);
            }
        }
    }       
    $terms = array_merge($terms, $existing_terms);
  } 

i attached the full edited taxonomy_action.inc as txt

CommentFileSizeAuthor
taxonomy_actions.inc_.txt3.33 KBJeschMB
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

infojunkie’s picture

Assigned: Unassigned » infojunkie
Status: Active » Fixed

Applied to both D5 and D6 dev. Thanks for your contribution.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.