There is a lot of similar questions here but I am having a hard time wrapping my head around this.

I have a taxonomy term reference field called field_category. This field is available on user/*/edit and on node/add.


  • 1
  • 2
  • 3

What I would like to do is send an email when a node is created that has the same taxonomy term(s) that a user has specified in their profile.

I have tried to wrap my head around using the rules and view_rules module but every configuration I have tried fails.

Can anyone provide me with some direction? Thanks!

Drupal 7.65

Rules: 7.x-2.12

Views Rules 7.x-1.0


Using pinueve answer, here is where I am at. The actions/conditions section of his answer is still unclear to me. My holdup is trying to match his example in the actions section.

enter image description here

{ "rules_area_of_expertise" : {
    "LABEL" : "area of expertise",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "mail" ],
    "REQUIRES" : [ "rules", "rules_conditional" ],
    "ON" : { "node_insert--answers_question" : { "bundle" : "answers_question" } },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_category" } }
    "DO" : [
      { "CONDITIONAL" : [
            "IF" : { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_category" } },
            "DO" : []
  • We don't know what configuration you're trying to use. If you export the rule configuration that might help someone in answering the question. As it is, the question is either too broad or off-topic.
    – mradcliffe
    Apr 16, 2019 at 21:55
  • @mradcliffe I have updated my question.
    – jpshayes
    Apr 17, 2019 at 18:17

2 Answers 2


install: views-rules-module, and rules-conditional module. Add in views a rules-view (is a new display type added by rules-view-module) of type USERS, add your category-field, hide from display, add relationship to taxonomy-vocabulary, add field: term-ID and UID. Both fields in views middle column set your fields as type: INTEGER. If you want you can delete user-field_category from this view. If needed, filter users by role or whatever to shorthen your view results, and important: no-pager, display all rows.

Now in rules: react-on: new content of type: your-content-type, conditions: entity-has-field: node-created-content: your field_category, actions: fetch-entity-by-id: taxnomony-term: value: drill in node until you find node-term-ID.

Add your new view-rule (find link at bottom settings in actions), now you have term-ID from user & UID, inside view-loop and a conditional, add an if, data-comparision, your NODE-term-ID vs USER-term-id, if equal, fecth USER by ID, with your variable UID, and send email. Done. Note: is possible that you will need to transform your NODE-term-ID as an integer.

Your rule will look like something like this: enter image description here

EDIT: first install rules Version: 7.x-2.11, i can see that you do not see 'conditional label' in rules action. To avoid to update rules module, install disable-updates-module

FIRST action should be 'fetch entity bt ID: tanonomy term', select your new node, and drill until you find term-ID.

SECOND action: add your users-views-rule. all following actionts take place inside rules-view-loop.

THRID action: inside rules view, data compare: your variable term-id from rules-view-users with NODE-term-ID (first action), if values match (are equal) then fetch USER by ID with your variable value UID from rules-view, now you have user object avilable, do send email to that user, rules-view will compare next user, and so on. here is another img of how will look your rule, notice how actions are taking place inside rules-view-loop.

enter image description here

and here is an img where you can find how to add your rules-view, it says "Add a view loop" at the bootom of img.

enter image description here

And this is how you set your fields inside rules-view, this is located in middle colum of your view.

enter image description here

  • I updated my question. I am getting closer. Could you post an export of your setup?
    – jpshayes
    Apr 17, 2019 at 18:19
  • Thanks for the update. I will give your addition suggestion a shot and let you know.
    – jpshayes
    Apr 17, 2019 at 20:45

I also wanted something similar. What I did was that I captured the node creation event using node_submit() hook and then triggered the mail based on the node value when it satisfied my required conditions. Maybe you can try something like that.

  • I am just getting back to trying to tackle this now. If the rules approach does not work I will try your suggestion. My php and knowledge of drupal 7 API is rusty.
    – jpshayes
    Apr 23, 2019 at 17:34
  • @jpshayes Let me know If you need any help with that.
    – Bej
    Apr 24, 2019 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.