Posted by jdp181 on August 25, 2009 at 4:42pm
Hi all, if someone could point me in the right direction I'd be very grateful.
I am setting up a simple rule to add a taxonomy term when a new node is created. The term name will be the title of the node.
I have added the title of the node to a new string variable, however when I go to add the taxonomy term action its still unavailable - "Assign a term to content - Unavailable argument: Taxonomy term". How do pass the argument?
I'm using drupal 6.13 and rules 6.x-1.0
Thanks
John
Comments
Create a term first
John,
You first need to create a term. Then you can assign the term to the content.
I think that's "Add term" and you can use the [node:title] there.
Good luck.
Alexis
how to add term
Alexis,
Thanks for your reply, that's the bit I seem to be missing - in my "Select an action to add" drop down there isn't an add term option which I was expecting to find - see attached image. Do I have to have some custom php code for it?
Thanks
John
Add term...
jdp181,
There was a patch that was added, probably only to the -dev at this time. So you probably want to use the 1.x-dev version.
You can also rewrite your own code... 8-)
Best,
Alexis Wilke
new release
thanks the good news is 1.1 was just released today (with the patch) so I don't need to run the dev version
Load a vocabulary
This is probably stating the obvious, but you need to select the action "Load a vocabulary" before the option "Add a new term" will become available.
Thanks! Now how do I prevent duplicates?
@gamutalarm - It wasn't stating the obvious! That just solved the problem I was having.
Now. My next problem... I'm building a project tracking system bespoke for the NAFC (www.nafc.ac.uk) I'm using a rule to create a taxonomy term when a user submits a form and the value of a form field is "Approved". Works beatifully first time. But then it does it if someone goes into that form and submits it again. We're getting duplicate taxonomy values added. Is there a way to check to see if a term is present already? Or am I missing something simpler...
Update... I'm using a checkbox CCK field that the rule examines the value of. If it's 0, create the term and set the checkbox to 1 as the last thing you do. If it's 1, don't do anything. Seems to work.
Please share
Can you maybe share your solution? Having the same question, but for D7...
Personally, I would do this
Personally, I would do this with a PHP action and make the taxonomy api work for you...
http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module
trying the same
I am also trying to add a taxonomy term when a content type is added.
When someone adds a brand, the brand title needs to be added to the Brand vocabulary.
I tried to make a rule for this, but it isn't working out so well. I can't figure out wich actions to add.
This is the action I have:
Parameter: Type: Taxonomy vocabulary, Value: brands
Provides variables: Added variable (variable_added)
I know I need to save the title in some variable and then add it to the terms, but I can't seem to find out how.
Could anyone help me the right way ? I'm pretty new to the rules module :)
never mind, fixed it with:
Parameter: Entity type: Taxonomy term, Name: [node:title], Vocabulary: [variable_added]
Provides variables: Created entity (entity_created)