Make WordPress Core

Opened 17 years ago

Closed 16 years ago

Last modified 8 years ago

#5698 closed defect (bug) (fixed)

Set timestamps for unpublished posts

Reported by: ryan's profile ryan Owned by: ryan's profile ryan
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.3.2
Component: Administration Keywords: date time
Focuses: Cc:

Description

Currently, we don't set timestamps for unpublished posts. This
results in drafts not ordering nicely by date and causes some
confusion among users. Empty timestamps are done mainly to
accommodate history bloggers who like to set their timestamps in the
past. We don't want to stomp their choice once they've made it.
There is another way, however, that will inconvenience them only
slightly while allowing us to provide real timestamps for drafts.

The edit post page has an "Edit Timestamp" checkbox. If checked, the
timestamp specified in the input boxes is given to the draft. This
timestamp sticks with it through publication. If "Edit Timestamp" is
never checked during save, the draft will have an empty timestamp
until published. We could turn the "Edit Timestamp" checkbox on its
head and call it "Reset to current time". This would be checked by
default for unpublished posts and unchecked for published and future
posts. If someone sets the time on their draft and wants it to stick,
they must uncheck "Reset to current time" every time they save. If
someone edits the timestamp, we uncheck reset to current time for them
and set a "use this edited time" flag.

Attachments (2)

modified.diff (438 bytes) - added by ryan 17 years ago.
Make sure drafts have modified time set
5698.diff (1.5 KB) - added by ryan 16 years ago.

Download all attachments as: .zip

Change History (22)

#1 @lloydbudd
17 years ago

"Set to current time"

The new experience sounds a little unfamilar to most people, but it is a problem worth solving and I don't have a better solution.

#2 follow-up: @filosofo
17 years ago

Why don't we instead leave the post_date alone (unset for drafts) but set the post_modified to reflect when a draft has been saved. Then we can sort drafts by post_modified.

#3 in reply to: ↑ 2 @filosofo
17 years ago

Replying to filosofo:

Why don't we instead leave the post_date alone (unset for drafts) but set the post_modified to reflect when a draft has been saved. Then we can sort drafts by post_modified.

Now that I look at the code, I see that this is the current behavior. So why do you say that the current behavior "results in drafts not ordering nicely by date and causes some confusion among users"? Whatever was saved most recently shows up first--isn't that what you'd expect?

#4 @ryan
17 years ago

post_modified isn't set until a draft is saved a second time. We should fix that.

Manage->Posts sorts by modified only when showing drafts, not when showing all. When looking at all posts, it would be nice to see the drafts sorted in with published posts instead of lumped the end. Right now, you can't see the draft post you just saved if Manage->Posts is paged unless you know to filter on drafts.

@ryan
17 years ago

Make sure drafts have modified time set

#5 follow-up: @ryan
17 years ago

Patch makes sure drafts have a modified time. That helps a bit.

#6 @markjaquith
17 years ago

+1 to setting the modified timestamp on the first save of the draft.

#7 in reply to: ↑ 5 @westi
17 years ago

Replying to ryan:

Patch makes sure drafts have a modified time. That helps a bit.

in [6643]

#8 @ryan
17 years ago

  • Milestone changed from 2.5 to 2.6

Might still be worth setting timestamps, but not for 2.5.

#9 @bryan868
17 years ago

  • Milestone changed from 2.6 to 2.5

Can we at least in 2.5 get the drafts to display in reverse chronological order like they should? Like posts. Right now the oldest draft is at the top, and it's rather irritating. Refer here: http://trac.wordpress.org/ticket/5758

#10 @ryan
17 years ago

Looks like mine do sort that way. Before [6643], however, drafts without modified time set would mess up the sort. If you have drafts without modified time, try re-saving and see if they sort properly.

#11 @lloydbudd
17 years ago

Ryan, I can confirm for newere drafts, I see the desired behavior.

#12 @ryan
17 years ago

  • Milestone changed from 2.5 to 2.6

#13 @redsweater
17 years ago

  • Cc redsweater josephscott added

FYI this issue affects blog clients using the XMLRPC interface, as well. Because the dateless drafts show up at the very end chronologically, any client who asks for "getRecentPosts" will miss even a freshly added draft from the WP interface.

Would be a great improvement if new drafts get sorted correctly into the XMLRPC mix for "recent"...

Cc'ing josephscott so he can hopefully stay tuned and make sure that whatever fix gets made here also propagates to XMLRPC.

#14 @ryan
16 years ago

Here's another method that sets post_date to the current time when a draft is saved but keeps post_date_gmt empty until the timestamp is explicitly edited. The empty post_date_gmt is used as the marker to indicate that post_date should be updated to the current time when saved.

@ryan
16 years ago

#15 @ryan
16 years ago

  • Milestone changed from 2.9 to 2.7

#16 @ryan
16 years ago

(In [8920]) Set post_date for drafts. see #5698

#17 @ryan
16 years ago

(In [8921]) Update post_date for old drafts during upgrade. see #5698

#18 @ryan
16 years ago

  • Resolution set to fixed
  • Status changed from new to closed

This ticket was mentioned in Slack in #core-restapi by aduth. View the logs.


8 years ago

This ticket was mentioned in Slack in #core-restapi by aduth. View the logs.


8 years ago

Note: See TracTickets for help on using tickets.