There is a small bug in node.module
When a node is being created, if it is previewed before being submitted, $node->created and $node->changed are DIFFERENT. ($node->created is set to the time when Preview was clicked; $node->changed is set to the time when Submit was clicked.) In this case, they should be the same.
My patch sets $node->changed to $node->created if the node has never been changed (meaning that it is in the process of being created).
Please view the patch file... it will make all of this more clear.
I originally ran across this bug while working on another patch, which I would really like to see make it into 4.7. It is a simple change... it gives the user an option of adding a "last revised" tag to the submission line. Please check it out and consider it for 4.7.
Thanks!
-Steve
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | node_preview_2.patch | 857 bytes | shouchen |
| node_preview_1.patch | 1.01 KB | shouchen |
Comments
Comment #1
shouchen commentedSorry... the problem exists in 4.7.0-beta2, but the patch is valid for the current node.module in HEAD.
Comment #2
morbus iffI'd turn this into a ternary:
$node->changed = !$node->changed ? $node->created : time();Lot smaller.
Comment #3
morbus iffActually, flip 'em:
$node->changed = $node->changed ? time() : $node->created;Comment #4
shouchen commentedComment #5
shouchen commentedGreat idea... thanks!
Comment #6
Steven commentedCommitted to HEAD.
Comment #7
(not verified) commentedComment #8
shouchen commentedThis bug was reintroduced by http://drupal.org/node/52710
Comment #9
Steven commentedNode->changed is an internal variable used for bookkeeping around revisions and search indexes. If you use it for display, that's your problem.
However, if you don't enter anything in the "authored on" field on node creation, the changed date should be the same as created though (function
node_save())