Hi!
I'm trying to create a rule that will unpublish an event after its end date. This should run by cron but I can't do that (see other issue in the queue) so for now I'm calling the rule in the "After updating existing content" event. It took me a while to realize the issue but should be fairly simple to reproduce following these instructions:
- Set a content type to be used as event or use the stock one provided by the event module;
- Create a triggered rule that will be evaluated at the "After updating existing content" event and add the following conditions and actions:
* Condition: Node -> Content has type (choose your content type)
* Condition: Node -> Content is published
* Action: Unpublish content
* Action: Show a configurable message on the site (select the option "Display as error message" and add your event date related tokens here like start and end months for example)
Save your rule and try it out.
At this point, this rule will simply unpublish any event node you try to publish and display the error message with your tokens that should be properly replaced.
Create a couple of event nodes with a start and end date, one with the end date for next month and the other with an end date for last month. Both will be unpublished like expected.
Now for the neat stuff.
Add a Numeric comparison condition to the rule where you evaluate if the "event start month" token is greater or less than "event end month" token. Save your rule and either create more event nodes or edit your existing ones (you can simply select and publish them in the Content Management page).
You'll notice that the error message won't display or if it does, it will be blank because the tokens won't be replaced by their values if they are compared or checked for a truth value. Weird, huh?
Tested with Rules 6.x-1.0-beta3 and 6.x-1.x-dev + Token 6.x-1.11 and 6.x-1.x-dev + Event 6.x-2.x-dev on the latest drupal 6.
Ricardo
Comments
Comment #1
fagoDoes this issue only occur with event related tokens? Please also try tokens provided by the token module. Also make sure you have a recent token module as noted on the rules project page, Token 6.x-1.11 is too old.
Comment #2
mitchell commentedPlease reopen if upgrading token does not fix this issue.