Major Revision Only Timestamp
Last updated on
30 April 2025
We ran into a scenario where we needed to sort nodes by the last MAJOR revision timestamp (ie. only when they ticked the Revision checkbox). We created a new computed field that generates a new timestamp when a node is first created and only updates the timestamp if the Revision checkbox is ticked. This new CCK field is then exposed to the Views module to allow sorting by this timestamp instead of the $node->changed value.
Here is the simple snippet placed in the computed code field:
if ($node->is_new || $node->revision) {
$node_field[0]['value'] = time();
}
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion