[Resolved] [Plugin: WP to Twitter] XMLRPC – "post edited" instead of "new post"
When I use XMLRPC Client for publishing posts, your plugin sends “post edited” instead of “new post” to Twitter.
This is actually a bug in the XMLRPC client. Some XMLRPC clients post drafts with a specified post date, which causes problems in the ability of WP to Twitter to pick up the appropriate information for that post. WordPress does not supply a post date for drafts, and supplies a ‘date edited’ flag if it’s set to anything other than the current date – but these XMLRPC posts do not use that flag, which causes the plug-in to believe that they are older posts being edited.
There’s nothing I can do about this.
I use official one – http://windowsphone.wordpress.org/
So does it mean they have a bug there?
Possibly. I haven’t tested that application. The main application I’ve found this problem in is Windows Live Writer, so it could be a limitation caused by something in Windows. Regardless, this is common with XMLRPC, and I can’t do anything about it.
sorry to hijack this thread..
just curious is there any workaround on this bug?
I’m using metaweblog API – newPost method when creating new post.
And not entirely sure why new tweet is not posted.
Is there any custom field that we can use? Or what is your proposed solution since I’m writing my own xmlrpc client.
Note: I’m using wp3.4, but not using xmlrpc wordpress api, because its newPost and editPost methods are probably having bugs on terms/taxonomies.
can you suggest any custom fields that we can add as workaround ?
You should be able to make it work fine configuring your XMLRPC client to behave the same way as the native WP admin:
1) If you aren’t specifying a particular date, do not send a date to WordPress
2) If you are specifying a particular date, also set the ‘date_edited’ flag. I don’t remember the exact field specifications off the top of my head for the name/value pair for date_edited; but you can get that fairly easily by checking the POST array when saving a post where you’ve edited the date.
I believe that would work for you; but I haven’t tested it. (Since I’m not writing my own XMLRPC client…)
I’m not sure what the impact of using something other than the WordPres XMLRPC api would be; you’re on your own there.
what data type you are referring for ‘date_edited’ flag ? boolean/bit or datetime ?
I only can find these in the API doc.
And I have tested setting those fields below and it doesn’t work either.
datetime post_modified datetime post_modified_gmt http://codex.wordpress.org/XML-RPC_WordPress_API/Posts
datetime date_modified datetime date_modified_gmt http://codex.wordpress.org/XML-RPC_MetaWeblog_API
It could be that the date_edited flag isn’t in the XMLRPC API — honestly, I don’t know. I don’t work with the XMLRPC API at all.
It’s part of the standard post saving process.
It is just a boolean that indicates whether the date has been edited.
(Just checked my notes, and the name of the POST field is “edit_date”.)
I did a trace on your plugin code.
on function jd_twit_xmlrpc:
2012-12-01 15:00:53 - jd_twit_xmlrpc triggerred. ID: #POST_ID# 2012-12-01 15:00:53 - value - is new : 0 2012-12-01 15:00:53 - value - _postDate : 2012-12-01 22:55 2012-12-01 15:00:53 - value - _postModified : 2012-12-01 23:00 2012-12-01 15:00:53 - option jd_tweet_default : 0 2012-12-01 15:00:53 - option jd_twit_remote : 1 2012-12-01 15:00:53 - value - postStatus : publish
I send a post with postDate 2012-12-01 22:55, but my system time is 23.00. This is the result of my test.
Whether I set postModified on my client, it’s totally irrelevant. It will not use the given value.
And edit_date boolean doesn’t help either.
What I don’t understand is why wordpress getPost give _postModified as system time. And your code use this to determine if it’s a new post or edit post. >_<
Well, _postModified literally refers to the system marking the date and time that the database was edited. So, I think it’s very logical it would use the system time for that. So that’s entirely consistent with what I’m describing. When the WP admin publishes a post, the post automatically is published as “right now” (using the system time, as well), unless that date has been manually modified. If it has been modified, WP sets a boolean flag indicating that the post time has been modified – edit_date.
- The topic ‘[Resolved] [Plugin: WP to Twitter] XMLRPC – "post edited" instead of "new post"’ is closed to new replies.