December 29, 2008
Drupal Published Date equals Effective Date fix
We have a gaming site where the node creation date is irrelevant to the user as they only see it once it is published by our moderators.
Surprisingly, there is no “published on” date in the original Drupal database, so the Views can only sort by the mysterious “created on” date.
As I didn’t want to hammer this problemmette away with the formidable Scheduler module, here’s a quick fix.
Get the Rules module and add this triggered rule:
- After updating existing content
- Conditions: updated content type fits, NEGATE “unchanged content is published”, “changed content is published”
- Custom PHP action:
$node->created = time();
return array(“node” => $node);
Seems to work just fine.
Now I can use the “posted on” date in Views to display the games in a logical manner. Too bad there is no way to do this retroactively.
Here’s my Rules screen shot:
And a related article: http://drupal.org/nyobserver.