WordPress.org

Ready to get started?Download WordPress

Forums

WP to Twitter
XMLRPC - "post edited" instead of "new post" (11 posts)

  1. mlndsk
    Member
    Posted 1 year ago #

    Hi,

    When I use XMLRPC Client for publishing posts, your plugin sends "post edited" instead of "new post" to Twitter.

    Thanks

    Milan

    http://wordpress.org/extend/plugins/wp-to-twitter/

  2. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. mlndsk
    Member
    Posted 1 year ago #

    I use official one - http://windowsphone.wordpress.org/

    So does it mean they have a bug there?

  4. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. holmes221
    Member
    Posted 1 year ago #

    hi joe,

    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.

    codex.wordpress.org/XML-RPC_MetaWeblog_API

    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.

  6. holmes221
    Member
    Posted 1 year ago #

    can you suggest any custom fields that we can add as workaround ?

  7. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  8. holmes221
    Member
    Posted 1 year ago #

    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

    OR

    datetime date_modified
    datetime date_modified_gmt
    
    http://codex.wordpress.org/XML-RPC_MetaWeblog_API
  9. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    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".)

  10. holmes221
    Member
    Posted 1 year ago #

    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. >_<

  11. Joe Dolson
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags