Unpublish node based on date field with Rules I'm trying to unpublish a node based on a date field with Rules.
I've followed this tutorial but somehow it doesn't seem to work.

Here's my Component:

{ "rules_unpublish_termin" : {
    "LABEL" : "Unpublish Termin",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "node" : { "label" : "node", "type" : "node" } },
    "ACTION SET" : [ { "node_unpublish" : { "node" : [ "node" ] } } ]
  }
}


And here's the Rule:

{ "rules_unpublish_termin_rule" : {
    "LABEL" : "Unpublish Termin Rule",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_scheduler" ],
    "ON" : { "node_insert--termin" : { "bundle" : "termin" } },
    "IF" : [ { "node_is_published" : { "node" : [ "node" ] } } ],
    "DO" : [
      { "schedule" : {
          "component" : "rules_unpublish_termin",
          "date" : [ "node:field-termin-datum:value" ],
          "identifier" : "Unpublish content ID [node:nid] ([node:title]).",
          "param_node" : [ "node" ]
        }
      }
    ]
  }
}


I'm fairly new to Drupal and I've never used the Rules module so I'm not sure if there's something else I'm missing here.

edit:
I've been looking into it a bit more.
Currently I have 3 nodes in this bundle with the following dates:
2018-01-09 (which should have been unpublished today)
2018-05-12
2018-07-14

In the Tab Schudule under admin/config/workflow/rules/schedule I can see that the component rules_unpublish_termin has a Schedule Date for 2018-07-14 00:00 which would correlate with the very last date, this seems a bit odd..
1. Timing of a scheduled Rules Component

After a rule is scheduled (using the Rules Scheduler, a submodule of Rules), it will only actually execute next time cron runs. Example:


schedule a rule to execute at timestamp X (which appears to be node:field-termin-datum:value in your case).
if the next time that cron runs is at Y mins after timestamp X, then the Rules execution will only happen then (= at Y mins after timestamp X).


BTW, as per the edit of your question, it seems that the Rules Component actually does get scheduled, and that your real issue is related to the execution of that scheduled component ... read on for more details about that.

2. Cron runs anonymous

Cron (always) runs with user anonymous, rest assured about that (in any Drupal 7 site). But here is an "educated" guess: your site is configured so that anonymous users are NOT allowed (= do not have the permission) to unpublish nodes.

Up to you to confirm if my guess is correct, but if it indeed applies, the answer to your question is that to get this to work you would need to grant anonymous users the permission to unpublish nodes. I bet it is not going to be what you want to do (I wouldn't ...), but trust me, that would be a prereq to make it all work in your site.

3. If everything else fails ...

If none of the above helps to find out what is causing your issue, then try either of these suggestions to get a better understanding of what is (not?) happening:


Try to execute your Rules Component "manually" (just to test), to unit-test if it works as desired, so without using the Rules Scheduler. To do so, use the "execute" link to the right of the Rules Component (in the Rules UI).
Do some Rules debugging ... For way more details about that, refer to the answer to "How can I display the value of a variable inside a condition?".