#826 closed defect (duplicate)
Post Date hard set on server when saving a Draft
| Reported by: | alexkingorg | Owned by: | daniloercoli |
|---|---|---|---|
| Priority: | minor | Milestone: | Future Release |
| Component: | XML-RPC | Version: | 2.7.1 |
| Keywords: | Cc: | joseph@…, devin@… |
Description
When creating a draft post from one of the WordPress iOS apps the post date is set to an explicit time/date (the current time/date) when you save a draft post back to the server.
I would expect not setting the post date/time explicitly in the iOS app to have the same effect as not setting the post date/time explicitly in the WP web admin interface. If you do not set the post date/time explicitly, it is not set and hitting publish will then populate the current date/time value.
This becomes a problem in the scenario where you save a draft with some notes from your iPhone, then edit this post in the WP web admin interface to finish it up. If you simply hit the Publish button as normal in the the web admin interface, you will publish the post in the past (at the time/date the draft was pushed to the server).
This is further complicated because the date of the post will often have an effect on the post's URL. If you use a URL structure such as:
/YYYY/MM/DD/post-slug/
then the URL will likely change once you realize what has happened and fix the date. If you are pushing your posts to any other sources (Twitter, Facebook, etc.) then this becomes an additional problem because the URL that is initially sent to those services may no longer work.
This happens on both iPhone/iPod and iPad.
Change History (20)
comment:1 Changed 14 years ago by
| Milestone: | Next Release → 2.7.2 |
|---|
comment:2 Changed 14 years ago by
| Owner: | set to daniloercoli |
|---|---|
| Status: | new → assigned |
comment:3 Changed 14 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:4 Changed 14 years ago by
in [1857] I fixed the date issue on the app.
When you start a new post, the app sets the datetime field only when the user explicitly sets a datetime using the UI.
The app works fine right now, but there still the issue on the server side, that set the datetime to currentdate when a draft post /page is uploaded.
This is the request we made from the app when a new post is created (no date was set on the UI):
<?xml version="1.0"?><methodCall><methodName>metaWeblog.newPost</methodName><params><param><value><i4>1</i4></value></param><param><value><string>editore</string></value></param><param><value><string>XXXX</string></value></param><param><value><struct><member><name>title</name><value><string>Danilo danilo</string></value></member><member><name>categories</name><value><array><data></data></array></value></member><member><name>description</name><value><string></string></value></member><member><name>post_status</name><value><string>draft</string></value></member></struct></value></param></params></methodCall> 2011-03-28 11:15:11.663 WordPress[1074:a327] executeXMLRPCRequest response: <?xml version="1.0"?>
we are not sending the datetime field because I haven't set the date using the UI. The server response, for example, look like this:
response: <?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value>
<string>166</string>
</value>
</param>
</params>
</methodResponse>
just after the post is created i started a getPost request and it returns the post from the server with the datetime already set:
<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member><name>dateCreated</name><value><dateTime.iso8601>20110328T10:15:11</dateTime.iso8601></value></member>
<member><name>userid</name><value><string>2</string></value></member>
<member><name>postid</name><value><int>166</int></value></member>
<member><name>description</name><value><string></string></value></member>
<member><name>title</name><value><string>Danilo danilo</string></value></member>
<member><name>link</name><value><string>http://www.eritreo.it/validator/?p=166</string></value></member>
<member><name>permaLink</name><value><string>http://www.eritreo.it/validator/?p=166</string></value></member>
<member><name>categories</name><value><array><data>
<value><string>Uncategorized</string></value>
</data></array></value></member>
<member><name>mt_excerpt</name><value><string></string></value></member>
<member><name>mt_text_more</name><value><string></string></value></member>
<member><name>mt_allow_comments</name><value><int>1</int></value></member>
<member><name>mt_allow_pings</name><value><int>1</int></value></member>
<member><name>mt_keywords</name><value><string></string></value></member>
<member><name>wp_slug</name><value><string></string></value></member>
<member><name>wp_password</name><value><string></string></value></member>
<member><name>wp_author_id</name><value><string>2</string></value></member>
<member><name>wp_author_display_name</name><value><string>editore</string></value></member>
<member><name>date_created_gmt</name><value><dateTime.iso8601>20110328T09:15:11</dateTime.iso8601></value></member>
<member><name>post_status</name><value><string>draft</string></value></member>
<member><name>custom_fields</name><value><array><data>
</data></array></value></member>
<member><name>sticky</name><value><boolean>0</boolean></value></member>
</struct>
</value>
</param>
</params>
</methodResponse>
comment:5 Changed 14 years ago by
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
comment:7 follow-up: 8 Changed 14 years ago by
Looking at core source (http://core.trac.wordpress.org/browser/trunk/wp-includes/post.php#L2666), it seems like setting '0000-00-00 00:00:00' as the date on mw_editPost should work.
So maybe, set it to nil on getPost if status is draft, and then translate nil to '0000-00-00 00:00:00' on mw.editPost
Sounds right?
comment:8 Changed 14 years ago by
So maybe, set it to nil on getPost if status is draft, and then translate nil to '0000-00-00 00:00:00' on mw.editPost
Sounds right?
This doesn't work if the user set the date field and save the post as draft on the web dashboard.
comment:9 Changed 14 years ago by
| Cc: | joseph@… added |
|---|
comment:10 Changed 14 years ago by
| Milestone: | 2.7.2 → 2.8 |
|---|
comment:11 Changed 13 years ago by
| Milestone: | Future Release → 2.9.4 |
|---|
Maybe [2370] helps with this, test again for 2.9.4
comment:12 Changed 13 years ago by
| Milestone: | 3.0 → 2.10 |
|---|
comment:13 Changed 13 years ago by
| Milestone: | 2.10 → 3.0 |
|---|
This doesn't seem to be fixed yet in core trunk.
comment:14 Changed 12 years ago by
| Cc: | devin@… added |
|---|
comment:15 Changed 12 years ago by
| Milestone: | 3.1 → 3.2 |
|---|
comment:16 Changed 12 years ago by
| Milestone: | 3.2 → Future Release |
|---|
The core ticket was moved to 'Future Release' 5 months ago. We may bring this up in the next weekly core chat.
comment:17 Changed 12 years ago by
| Component: | Publishing → XML-RPC |
|---|---|
| Priority: | major → minor |
Should we try implement the new XML-RPC methods? Any fixes core side would require bumping the minimum WordPress version anyway, so we might as well migrate to the wp.* methods
comment:18 Changed 11 years ago by
Just FYI - This is still happening, and is a major hitch in my process, since I use it for my authors to send in drafts. I'm having to adjust the time any time I want to publish, and since it can be a day before I get there, I end up with a post dated the wrong day.
If you're right-now-posting, this isn't a problem, of course, so this is a minority issue :)
comment:19 Changed 11 years ago by
| Resolution: | → duplicate |
|---|---|
| Status: | reopened → closed |

(In [1857]) partially fixes #826