question about wordpress

by 11 replies
13
Hi,

I don't know if anyone knows anything about programming, or can redirect to to a place where someone might be able to offer a suggestion...

But I am trying to create a custom wordpress plugin (PHP), and using the XMLRPC -- calling the wordpress post.

However, I can't seem to figure out what type of data the "dateCreated" should contain. I keep getting a malformed data error. Does anyone have any idea?

I.e.,

$content['dateCreated'] = .........?
$client->query('metaWeblog.newPost','','user','password' ,$ content,false))

I can't seem to figure out what type of data the data should be. Just sticking something like "08-08-2008" doesn't seem to work. Any ideas?
#programming #question #wordpress
  • Hi Jonathan

    It's just a guess but it may be looking for a properly formatted SQL date, or maybe an SQL timestamp.

    The SQL date format for today would be "2009-04-01".
    The SQL timestamp format for today at noon would be "2009-04-01 12:00:00".

    Again, it's just a guess!

    Bill
    • [1] reply
    • Hi Bill,

      Thanks -- I tried the SQL timestamp, but that didn't work And the frustrating thing is, I can't seem to find any 'good' wordpress documentation (a lot of it is gobblelegook)... Any other ideas? Or perhaps ideas on where I can find out?
  • I can sympathize - I've always planned to write a plugin for WordPress one day and ironically I now find myself spending today writing my first component for Joomla instead! If the WP documentation is anything as sparse as the Joomla stuff is then I can really feel your pain!

    I assume you've already poured through the documentation on the WordPress site? This looked like a good point to start - Writing a Plugin WordPress Codex - I'm sure you've already been through that. This one also looked useful:
    Function Reference/wpdb Class WordPress Codex - again I'm probably not telling you anything you don't already know.

    I'll be following this thread to see if anyone else has good resources for writing WP Plugins, as I said I do plan to do that one day.

    Best of luck

    Bill
  • One other note Johnathan:

    This looks like it may be useful - Rad Geek’s Projects How to deal with dates and timestamps in WordPress

    Bill
    • [1] reply
    • Thanks -- I checked that out, didn't seem to work
      Yes, the wordpress documentation is really screwed up (I'm amazed anyone has managed to create a plugin in the first place! )... From what I can gather, it 'seems' as if I need to create some kind of "date" object, but I'm not sure how to do that...

      (It seems I can't simply pass a string, but I actually need to have some kind of date object... Do you know of any such objects?)

      Thanks!

      Johnathan
  • In this statement you gave:

    $client->query('metaWeblog.newPost','','user','password' ,$ content,false))

    There is a space between the $ and content and there shouldn't be. It should be $content not $ content. See what I mean?

    Would that have anything to do with it?
    • [1] reply
    • Thanks, no, no, that's not it.

      It seems that some kind of 'date' object is required to be sent (I am assuming that, because it seems that I have to "guess" how to program in wordpress ) Spent about 2-3 hours "guessing" what different formats it would want it in, because there doesn't seem to be any dox, etc...Closest I could come up with is 'datetime', but that is php 5.2.0, so am not sure what other alternatives... trying to work within the wordpress 'sandbox', but seems like I just have to simply manually edit it via sql...
      • [1] reply
  • Found this on a WordPress User Group site:

    $post_date = mysql2date("Ymd\TH:i:s", $postdata['Date']);

    "dateCreated" => new xmlrpcval($post_date,"dateTime.iso8601");

    I included the first line so you would see the formatting they applied to $post_date. The second line looks like the code to create a date object. Let us know if it works.

    Lisa
    • [1] reply
    • Thanks, tried it, doesn't work Seems I need to install some kind of library/server to support the 'xmlrpcval' class, and I don't think I have the required priveleges on my server (plus when I have tried installing 3rd party libraries, seems to screw somethnig else up )

      thanks for the suggestion...! Any other ideas?

Next Topics on Trending Feed