I have a problem with the removing of terms from content.
$node->taxonomy is keyed off the vocabulary id ($taxonomy_term->vid) and not the term id ($taxonomy_term->tid).
I am thinking that both:
rules_action_taxonomy_term_assign_to_content
rules_action_taxonomy_term_remove_from_content
are using $taxonomy_term->tid like this:
if (!isset($node->taxonomy[$taxonomy_term->tid])) {
and I think it needs to use the vid like this:
if (!isset($node->taxonomy[$taxonomy_term->vid])) {
Here is a patch that should update both the vid issue as well has handling adding and removing single and multi-select vocabulary terms.
Is it a problem to always "return array('node' => $node);" even if the $node didn't change?
Comments
Comment #1
hawk259 commentedSorry, rules.diff is a old diff. Please use this one rules-v2.diff (removed the free form tag removing code as it is not needed).
Comment #2
fagohm, I think $node looks different depending on the stage in the node editing process. Afaik token has also some troubles with that. So if you can make the code more robust, +1 for that.
However your patch has some tabs in it, please make sure the follow the drupal coding standards http://drupal.org/coding-standards
I'd also prefer to have another tester who verifies that it stays working, as I've never used that one.
>Is it a problem to always "return array('node' => $node);" even if the $node didn't change?
Yes it would be saved for nothing. So only do that, if you have changes to save.
Comment #3
hawk259 commentedYour right, $node->taxonomy bounces around with the format:
http://drupal.org/node/379564
I will follow up with a new patch once I work out the details of the above bug.
Comment #4
fagoin the meanwhile there are such actions.