I found that node taxonomy conditions weren't working on my site. I traced it down to context_condition_node_taxonomy.inc using the language of the node rather than the language of the field.

Attached is a patch to correct this.

Comments

drasgardian’s picture

StatusFileSize
new860 bytes

here's the patch file

mathieuhelie’s picture

Title: node taxonomy condition failing on multi language site » node taxonomy condition failing on translated or multilanguage site

Thanks for the fix. I'm building a single-language site (non-English) and was running into the same problem.

Anonymous’s picture

Thanks for the fix. It's working and solved my problems on that bug.

k4v’s picture

StatusFileSize
new1.32 KB

I just came across the same bug and fixed it, before i found this =).

i used field_get_items() instead -- which is the best way to do it?

romsP’s picture

#4 works well for me.

Anonymous’s picture

#4 works well for me too !

antoniomanco’s picture

Hello.

A question. I need replace all code in context_condition_node_taxonomy.inc with the patch? or Add the patch to existing code? thanks

bojanz’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.16 KB

@antoniomanco
See http://drupal.org/patch/apply

field_get_items() is cleaner. Seems like this is the only case of incorrect field language usage in context.

#4 wasn't rolled correctly. Attaching a reroll and marking RTBC.

kelvinleehk’s picture

Status: Reviewed & tested by the community » Needs review

I can't seem to apply this this patch. Git apply -v simply returns no result / error / nothing and the file was not patched whatsoever. I downloaded the file to sites/all/modules/context and git apply it from there. The patch in #4 worked fine though.

bojanz’s picture

patch -p1.

kelvinleehk’s picture

Tried as some suggested that git apply does not work from within the local checkout of an unrelated git repository. Didn't work as I hoped.

FYI I'm running Git 1.7.6.

Anonymous’s picture

I just tried for 2 long hours to figure this out somehow until I ended up here and OMG the patch already exists! Thank you :-)

patch from #8 works perfectly here.

bojanz’s picture

Status: Needs review » Reviewed & tested by the community

Great, thanks for testing.

skwashd’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/plugins/context_condition_node_taxonomy.incundefined
@@ -51,8 +51,8 @@ class context_condition_node_taxonomy extends context_condition_node {
+        if ($terms = field_get_items('node', $node, $field)) {

This could be easier to read. I propose doing it like so:

$terms = field_get_items('node', $node, $field);
if (FALSE === $terms) {

I personally really dislike if assignment statements.

brenk28’s picture

StatusFileSize
new1.15 KB

This is a version of the above patch from #8 to use in a make file.

DrJochum’s picture

Patch form #8 did not work for me.
But the original one from #1 was fine!

I am using dupal 7.10

tekante’s picture

Status: Needs work » Fixed

Committed to 7.x-3.x with commit f5966dc5e3aea325802ea41e6ca26ba9ad90d2c0, will be available in next dev build. Thanks for the bug report and to those helping to roll a patch.

Status: Fixed » Closed (fixed)

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

rafinskipg’s picture

Patch in #4 worked, but it wasn't prepared for git patcher... I had to modify it.