This seemed easy from the glance, but me as a newbie just can't get it right. This is what I want: I have a nodetype that has some multiple select taxonomy (3 terms, x,y,z). Than there is a nodecomment type, with another multiple select taxonomy (2 terms, a,b). (No parenting relationships are needed between those two vocabularies) EXAMPLE: say i blog about 3 holiday destinations Paris, London, New York, and people comment with "pros" and "cons".

So, simply, what i want is a view (list of node comment links) of say "pros" for all "New York" tagged blogposts. If that is too much, than I could satisfy with a list of all node comments for a particular blog tag, like latest node comments for blog posts tagged "new york". Any hints???

Comments

dark.o’s picture

basically, it could be done by child node inheriting parent nodes taxonomy. have been reading around about this issue and I could not find a sollution. Anybody?

dark.o’s picture

Title: View with a list of node comments based on node taxonomy » View with a list of node comments based on parent node taxonomy
dark.o’s picture

Title: View with a list of node comments based on parent node taxonomy » Node comments inherit parent node taxonomy term
Category: task » feature
merlinofchaos’s picture

Category: feature » support
Status: Active » Fixed

Ok, here is what I think you have to do.

1) create a module weight a weight higher than nodecomment so it runs last.
2) create a form_alter on the node edit form. Look for $form['#node']->comment_target_nid -- if that exists, the form is a nodecomment and that nid is the original node.
3) Make sure your vocabulary is valid for your nodecomment node.
4) Using your form alter, change the #access on the select select for the vocabulary in question to hidden and place the terms from the parent node in the #value for that widget.
5) You may then need to manually edit and save existing nodecomments to get them categorized.

dark.o’s picture

Thank you for your help merlinofchaos! That would sure help, once i find somebody that can transform that in action, since I am more of a "what-I-see-is-what-I-got" user (no skills in altering modules, PHP, coding etc.)

dark.o’s picture

There is no chance in getting this tutorial in a more "for-dummies" version? :D I reccon lots of people running forums with node comments would like this feature too.

merlinofchaos’s picture

ACtually, in forums you specifically do *not* want the comments to inherit the terms, because then they will show up as top level forum posts. We call that bad.

dark.o’s picture

Okey mr MOC, thank you for the info regarding forum posts. If you have any other comments regarding me wondering about "taxonomy-inherit-for-dummies", please post it.

Status: Fixed » Closed (fixed)

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

fersman4’s picture

Any word on this? It's been a few weeks. Kind of surprising that the concept of taxonomy inheritance was not one of the primary design goals of these two modules to begin with, since it is a built-in aspect of the default forum and comment Drupal modules.

fersman4’s picture

Status: Closed (fixed) » Active
merlinofchaos’s picture

Status: Active » Closed (fixed)

Sorry, if my answers are not good enough, you're out of luck. I've answered more than adequately.

fersman4’s picture

merlinofchaos, thanks for the quick reply. I'm not going to re-activate this issue, so hopefully you see this comment on a closed issue.

I believe I understand the rationale for not implementing this if one assumes post #7 is true. I don't understand why #7 is true, though, so perhaps I need to do more research. I would assume that the "top level forum posts" would be only forum nodes, not comment nodes, page nodes, or any other node type. The only way I could see #7 happening is if "top level forum posts" is defined as any node which has a forum taxonomy term selected. Is this the case?

Edit: I created a page with a forum taxonomy term. I didn't see the page included as a top-level forum topic, so I was not able to recreate the circumstances of post #7. I also tried it with a comment for completeness sake, with the same result.

merlinofchaos’s picture

That is, in fact, the case. Forums are not restricted to just the 'forum post' type.

merlinofchaos’s picture

Note that with nodecomment 2.x there is a relationship you can add, 'parent or self' or something like that, that you can use to get the right node to check terms against in a view.

fersman4’s picture

Oops, I didn't expect you to reply so quickly so I edited post #13 with an update. So that I don't mess up the comment order logic, I'll repost my update here:

I created a page with a forum taxonomy term. I didn't see the page included as a top-level forum topic, so I was not able to recreate the circumstances of post #7. I also tried it with a comment for completeness sake, with the same result.

fersman4’s picture

Yeah, that's a feature I may have to use. I was hoping to just use the base-drupal taxonomy system (e.g. taxonomy/term/1), which is simple. But I guess without nodecomment taxonomy inheritance, the views relationship method is the way to go, despite its complexity.

oskar_calvo’s picture

To make this there is a more easy way.

with hook_nodeapi:

<?php
 case 'comment':
      if($op == 'presave'){
        $node_father = node_load($node->comment_target_nid);
        $node->taxonomy = $node_father->taxonomy;
      }
    break;

?>

Only hidden the taxonomy as say merlinofchaos