I've done a bunch of searching but have not been able to determine where to begin, so I'm resorting to a forum post :)

I'd like to automatically/programmatically add taxonomy terms to a node based on its body content when I submit the node. For instance, if "Apple" and "Orange" is in the node's body content, the node would automatically be tagged with "Apple" and "Orange" from a specific taxonomy vocabulary. I'm not looking to do free tagging, but to apply tags to nodes that already have terms listed in a specific vocabulary.

Would a custom input filter be helpful? Or perhaps a custom module or at least some hook_form_alter() or hook_nodeapi() code to examine the content and add the terms programmatically?

Any direction would be appreciated!

Comments

nevets’s picture

Not exactly what you are after, Autolink does have a D7 version.

There is also Taxonomy Auto Tagger which is only D6 at this time but you could try porting it.

ayesh’s picture

Did you try Rules ?
There was a patch somewhere to do that.

hawkeye217’s picture

Rules and rules_autotag, both with 7.x versions available, look like it will do what I need. Thanks to all for the tipoffs!

Drave Robber’s picture

Taxonomy Autotagger for D6 did exactly this. I haven't looked into its code so can't tell how easy porting it would be, but even if isn't portable, you'll probably be able to borrow some ideas. Also, the maintainer is still active – maybe you can convince him that D7 version is worth it. :)