Comparison rule - taxonomy terms

Events happening in the community are now at Drupal community events on www.drupal.org.
jackmc's picture

Hi all, hoping I can get a bit of help with something.

I have a taxonomy (call it category) that I have added to both the node and the profile (user). On the node, a single category is required. A user can be assigned to multiple categories.

I have a rule triggered by workflow state change. I would like to add a condition that compares the node's categories with the list of categories on a user, and proceed if any of them match. I can see that this should be possible - via data comparison or the "in list" option, but I can't get it to work.

When it comes time to select the list to compare to, my field shows up, but I cannot select it. I can only select a level beyond it.

I want to access node:field-category and site:current-user:field-category, but I can only get site:current-user:field-category:parent-terms (or similar). It doesn't recognise the field itself as a valid list.

I've spent about a day on it which seems too long. I've also coded this in PHP before, but would like to be able to do it properly within rules if needed.

Any feedback would be appreciated, thanks in advance.

Comments

Have you set up a condition checking for the field?

drunkencelt's picture

Have you set up a condition checking for your field with the "Entity has field" condition? You will need to do this to bring the field data into play so you can access it.

Thanks for the response -

jackmc's picture

Thanks for the response - this one was user error. I thought I was comparing a list and a single value, but I was actually comparing two single values. This happened because I re-used the taxonomy field between the profile and node, and changed the setting - not realising that it was global.

Issue was resolved by creating two separate fields, which both reference the same taxonomy - one allowing a single value, and the other multiple.

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week