title: Drupal 7 Rules - on cron, check date field and if past set field [Status] from “active” to “ended”
body: <p>OK... let me start by saying I know there is a similar post here (<a href="https://stackoverflow.com/questions/16388792/drupal-7-rules-on-cron-check-date-field-and-if-passed-set-field-status-to">How to create a Drupal rule to check (on cron) a date field and if passed set field &quot;status&quot; to &quot;ended&quot;?</a>) but the answer on that post does not work. Step 4 (In the component add the condition 'Data comparison' and select node:type) does not work or even exists as an option.</p>
  
  <p>What I need to do is this:</p>
  
  <p>On Cron > If content type is <code>event</code> and the end date has passed the current date then change the <code>status</code> field from <code>Active</code> to <code>Ended</code>. (select list)</p>
  
  <p>I was able to do this by using the Event: <code>Content is viewed</code> but I really need to to work when cron is ran.</p>
  
  <p>Side note: with the current version I have (Content is viewed) it does change <code>Active</code> to <code>Ended</code> but it also for some reason deletes the title of the node which is strange becuase the title filed is required by Drupal... any idea wht that is happening?</p>
  
  <p>Not sure if it helps but here is an export of what I have done myself:</p>
  
  <pre><code>{ "rules_event_status" : {
      "LABEL" : "Event Status",
      "PLUGIN" : "reaction rule",
      "ACTIVE" : false,
      "REQUIRES" : [ "rules", "php" ],
      "ON" : [ "node_view" ],
      "IF" : [
        { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "event" : "event" } } } },
        { "AND" : [] },
        { "php_eval" : { "code" : "\/\/dpm(strtotime($node-\u003Efield_event_date_time[LANGUAGE_NONE][0][\u0027value2\u0027]));\r\nif (time() \u003E strtotime($node-\u003Efield_event_date_time[LANGUAGE_NONE][0][\u0027value2\u0027]))\r\n{\r\n    return true;\r\n}" } }
      ],
      "DO" : [
        { "data_set" : { "data" : [ "node:field-event-status" ], "value" : "Ended" } }
      ]
    }
  }
  </code></pre>
  
  <p>Any help is very much appreciated.</p>
  
  <p>Thanks</p>
  
  <p>C</p>