Time Since Last Node Modification - Numeric Comparison - How to Configure as a Condition? (SOLVED)

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

I am trying to use "time since node last updated" as a condition using numeric comparison. For instance, if a node has not been updated for 5 days.

I have tried tokens:

[node:mod-small]  and
[node:mod-since]

and various comparisons:

greater than + 5 days
less than - 5 days
and others

I am not able to make it work so that it is triggered if it is more than 5 days and is not triggered if it is less than 5 days.

When I use a Views filter, it is simply

Updated Date < - 21 days

Any help? Thank you.

Comments

Workflow Extensions project

rdeboer's picture

The Workflow Extensions project page has instructions to do something like this.
And you don't have to install Workflow or Workflow Extensions to make this work, just Rules and Tokens.

Thanks, the Workflow

itserich's picture

Thanks, the Workflow Extensions page is where I got the idea to use Numeric Comparison + the Node Modified Since token but perhaps it won't work. I can not find any prior comments on how this token is used.

The Workflow Extension page also comments on using PHP + a Truth Value. I tried

<?php return [node:mod-since] > strtotime('+2 days'); ?>

The goal is to trigger if a node has not been modified for at least two days, but anything I have entered there returns triggers a yes so I must be doing that wrong also.

Is the expression correct?

rdeboer's picture

Shouldn't that be a < and a mimus, rather than a > and a plus?

For a Views filter "Updated

itserich's picture

For a Views filter "Updated Since" the "less than" and "-X days" works, but it has not worked for the token [mod-since].

The list of tokens describes it as:

[node:mod-since]  Node modification in 'time-since' format. (41 years 24 weeks)

so I thought perhaps for the token it is a positive value.

I have tried dozens of different configurations. I think the Workflow module might allow something to be set up but was hoping to figure it out with Rules because I already have so many modules enabled.

Solved with - Workflow + Workflow Extension + Rules

itserich's picture

This ended up being very simple with the Workflow and WF Extension module.

By comparison, the Workflow Extension token is very simple to configure:

[node:workflow-state-age] Seconds elapsed since last state change

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