Hi,

I've introduced a new setting for the module. Right now, nodes that are created by Taxonomy Node get tagged by the parent term of the term they are related to. I've made this a setting and wrote a new option to add the term itself in the node's taxonomy.

Cheers,
TUc

Comments

tonyhrx’s picture

Just to say how useful this patch is.

In any of the views versions, you cannot use alpha-paged views of taxonomy terms because views page nodes, not terms.

Now I can create alpha-paged views of taxonomy nodes and link them back to eith er the taxonomy views, or in my case panels that take the termID.

Dix points.

hanoii’s picture

Assigned: Unassigned » hanoii
Status: Needs review » Needs work

I am planning on including this patch, however, I think I rather have two different checkboxes for selecting what should be used as the term of the taxonomy node, so you can have either of them, or both (parent and own term).

natuk’s picture

This patch worked well for me. I am not sure though that it makes sense to allow tagging with the parent term instead of the actual term. This module allows a one-to-one correspondence of a node to a term and the tagging should reflect that, no?

In a way tagging the node with the parent term is somehow arbitrary. Why not tag with sibling terms, or child terms?

Perhaps the above patch could be expanded to include child and sibling terms and in fact any other terms extracted based on a taxonomy relationship - but it feels that this is outside the scope of the module?

jvieille’s picture

The patch does not seem to work on the last dev

jvieille’s picture

Status: Needs work » Needs review

I made the modif manually.
This is exactly what I was looking for. It works perfectly for me, using in production from now.

If nothing wrong comes in the next days, and additional testers come up with positive experience I would suggest to to commit ASAP.

Thanks for this great improvement.

masondib’s picture

I agree that this is very useful and just wanted to put in a plug for the option of both parent and own term. This is what is needed in my use case. Thanks.

masondib’s picture

I got the checkboxes option working on my site by modifying TUc's patch above. Attached a patch below rolled against the 6.x-1.0-beta3 version (it's my first so I'd appreciate others testing it out). Hope it helps. Thanks for the great module.

digitalfrontiersmedia’s picture

This patch isn't quite right. Not sure if it's because the parent_term was already inserted into the variable table prior to adding the patch or not, but you can't just check for the existence of the parent_term key unless you're also removing the keys if the option has been turned off. Reason: The array key can be present but with an empty or zero value.

Result: Module will not add term to node if "term" isn't checked, but will add parent_term regardless. Thus, resulting in either node tagged with parent term or node tagged with BOTH parent and node term (depending on condition of 'term' checkbox).

Maybe best to simply test for the values:

<?php
    // Re-add the parents and/or the term as terms for this node
    if ($taxonomynode_settings['node_term']['parent_term']) { //check if parent_term is checked (1) or not (0)
      if (is_numeric($parents)) {
        $parents = array($parents);
      }
      foreach ($parents as $pid) {
        $node->taxonomy[] = $pid;
      }
    }
    if ($taxonomynode_settings['node_term']) { //check if node_term is checked (1) or not (0)
      $node->taxonomy[] = $tid;
    } 
?>

Doing it this way seems to work.

jlmeredith’s picture

Would it be possible for someone to roll #8 as a patch. I would be willing to pay someone a bounty as I need this feature for a project that is in production. I have applied the first patch but as indicated, it does not really fix the issue. Or if someone can tell me what line numbers need to be replaced with the code in #8?

masondib’s picture

Thanks for the correction, DigitalFrontier. array_key_exists() didn't feel quite right, but it worked for me so I went with it. Your solution is much better.

@jlmeredith, the code in #8 basically just replaces two lines from the patch in #7.

Replace these two:

<?php
if (array_key_exists('parent_term', $taxonomynode_settings['node_term'])) {
if (array_key_exists('term', $taxonomynode_settings['node_term'])) {
?>

With these two:

<?php
 if ($taxonomynode_settings['node_term']['parent_term']) { //check if parent_term is checked (1) or not (0)
 if ($taxonomynode_settings['node_term']) { //check if node_term is checked (1) or not (0)
?>
jlmeredith’s picture

Is it possible to get this rolled into a patch and then into the next release? Thanks!

jvieille’s picture

Does the new dev of today includes the patch?
Thanks

jvieille’s picture

keeping on top of my list

DrPhunk’s picture

running with 6.x-1.0-beta3 and there doesn't appear to be a checkbox to select either option.

can someone suggest which lines I would need to change to have it work the original way, i.e. assign the child term to the created node instead of the parent?

digitalfrontiersmedia’s picture

Took a while to get back to this, but since masondib concurs with my changes, I went ahead and rolled the changes to the original patch into a new patch per jlmeredith's request. This patch is against CVS HEAD (Revision 1.2). So, hopefully will get comitted.

Amy_M’s picture

Having a strange issue with this patch.

When creating a term in a hierarchy, it is now creating a duplicate term as a child for example if I am creating term B:

Instead of

Term A
- Term B

I am Getting:

Term A
- Term B
- Term B-0

Any Suggestions would be much appreciated, thanks for the great patch, it's really useful!

jvieille’s picture

not in the last dev yet

jvieille’s picture

Status: Needs review » Patch (to be ported)

Bump

jvieille’s picture

Any hope this will be committed ?
Five months of smooth usage