When posting or editing a node, users with the "administer nodes" privilege see a section titled "Authoring information," which includes a field labeled "Authored on:" which allows you to change the time/date of a node. When editing an already-existing node, this field is automatically populated with the time/date the node was originally posted, allowing the user to preserve the original time of the post. This is not a problem.
However, when creating a new node, this field is automatically populated with the time the user begins composing the node. This is extremely confusing because the node may not be submitted until much later, if it takes a while to write. When this happens, the node appears to have an incorrect timestamp.
The user can work around this by deleting the time/date entered into that field -- then the node's timestamp will be set to the time it was submitted. This, however, is counterintuitive, especially in version 4.7.0-beta5, since this field is initially hidden from view.
When creating a new node, the "Authored on:" field should be empty.
Comment | File | Size | Author |
---|---|---|---|
#17 | authored_on_enabled.png | 3.91 KB | Jaza |
#16 | authored_on_disabled.png | 3.78 KB | Jaza |
#13 | node.changed_0.patch | 4.47 KB | Steven |
#11 | node.changed.patch | 2.36 KB | Steven |
#7 | authored_on_0.patch | 1.85 KB | hunmonk |
Comments
Comment #1
archatas CreditAttribution: archatas commentedDon't you think, that if the timestamp is empty when you start creating a node and you want to create that node with the yesterday's date, it will be hard to guess the format of the timestamp?
Comment #2
Sage-1 CreditAttribution: Sage-1 commentedYes, but that can be resolved by providing a label with the format either next to the text box or elsewhere on the page. In fact, you could change the header to display the current date in the correct format as an example, and the user could copy-and-paste to achieve the same results if desired -- that is, you could change "Authored on:" to "Authored on: (2006-03-10 14:17:54 -0600)"
Either way, confusion about the format should be resolved in some way other than automatically populating the Authored On field for a new node. As it stands, users with the "administer nodes" privilege experience a different behavior than users without the privilege. Users with the "administer nodes" privilege should be able to change the behavior, but the default behavior for both types of users should be the same.
Comment #3
Sage-1 CreditAttribution: Sage-1 commentedThis bug still exists in RC1
Comment #4
Sage-1 CreditAttribution: Sage-1 commentedStill in RC2
Comment #5
hunmonk CreditAttribution: hunmonk commentedi agree the behavior should be consistent. here's a simple fix based on a suggestion in the thread. tested and working on current HEAD...
Comment #6
hunmonk CreditAttribution: hunmonk commentedhm. there are several problems with that last approach. working on a better solution...
Comment #7
hunmonk CreditAttribution: hunmonk commentedok, much happier w/ this effort... :) this patch displays a format description for the authored field upon new node creation, but leaves the field empty and not required. upon form submission, the current time becomes the creation time. for already created nodes, the creation time is populated and the field is marked required.
Comment #8
hunmonk CreditAttribution: hunmonk commentedalso, i tested this patch under both new node creation and node edits, and it seems to work flawlessly.
Comment #9
chx CreditAttribution: chx commentedAn excellent application of form API powers. Works as advertised.
Comment #10
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedapplied
Comment #11
Steven CreditAttribution: Steven commentedThis patch was bogus as far as I can tell: node_validate() still unconditionally requires a valid date for admin users. Leaving it empty (the default for node/add) results in a validation error:
Perhaps validation was broken when this was tested?
Anyway, I don't like the complexity of this approach. There is no reason IMO to make this a special case only for editing.
A scenario which often happens on Drupal.org is that we write announcements as unpublished posts which are revised several times. Then, when the announcement is ready to go live, we change the time to that moment and published it. Why shouldn't this be possible by emptying the date field, relying on node_save() to set it to the current time()?
Attached patch:
- Extends the approach for new nodes to apply to editing as well
- Only validates the node creation date if one was specified (addresses the bug I'm seeing)
Comment #12
Steven CreditAttribution: Steven commentedComment #13
Steven CreditAttribution: Steven commentedSorry that wasn't thorough enough.
Thanks to this patch, we have no excuse to mess with node->changed anymore. Now we can definitely keep node->changed as the actual time of submission (so it is a 100% dependable, internal variable for bookkeeping), while node->created is the visible time, either set by the user, or equal to the time of submission. This means the node_update_index() no longer needs to look at node->created.
So, to sum up:
- At node/add, the authored on field defaults to empty.
- At node/edit, the author on field defaults to whatever node->created was before
In both cases you can either fill in a date to keep it, or leave the field blank to set it to the form submission time.
Comment #14
deekayen CreditAttribution: deekayen commentedI verified the validation problem exists in CVS. My preference is to pre-fill the date. If you want to change it, then something is already there to modify AND give an obvious reference how to format the timestamp. Don't make it a required field and have the save function fill in the current timestamp if the form is blank on the timestamp field. That would make it easy to just delete an old timestamp and hit submit to update to the current time().
Comment #15
Jaza CreditAttribution: Jaza commentedI agree that the date field should be pre-filled when editing an existing node. If revisions are being used, then automatically setting the created date to time() is no problem, because the old created date will still be stored in the previous revision. But if revisions aren't being used, then the original created date of an existing node will be completely wiped out, and this will seriously mess up a lot of data for a lot of users.
Setting a draft node to 'published' is one use case where the 'created' date needs to be updated. But simply updating an existing published node is another use case, and it's one where the 'created' date should not be updated: the node is being changed, not being created! The latter use case is just as common as the former, and we need to support both.
Moving forward (i.e. in 4.8), I'd like to see the introduction of a checkbox called 'use time of form submission', which will disable and wipe the 'authored on' field when checked (using JS), and which will re-enable the 'authored on' field and re-populate it with the created time when unchecked (default will be unchecked). I've attached some mockup images of this possible UI change below.
Comment #16
Jaza CreditAttribution: Jaza commentedComment #17
Jaza CreditAttribution: Jaza commentedComment #18
Steven CreditAttribution: Steven commentedUm, we already support both? Editing an existing node will not touch the the 'created date' unless you manually clear the date field.
Comment #19
Steven CreditAttribution: Steven commentedCommitted after green light from chx.
Comment #20
shouchen CreditAttribution: shouchen commentedLooks like the changes associated with this issue have reverted the change fixed in http://drupal.org/node/41973. Is there a reason?
Comment #21
(not verified) CreditAttribution: commented