question about wordpress

11 replies
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?
#question #wordpress
  • Profile picture of the author mywebwork
    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
    {{ DiscussionBoard.errors[659107].message }}
    • Profile picture of the author Johnathan
      Originally Posted by mywebwork View Post

      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
      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?
      Signature
      Make money from writing, find out how now.
      {{ DiscussionBoard.errors[659111].message }}
  • Profile picture of the author mywebwork
    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
    {{ DiscussionBoard.errors[659452].message }}
  • Profile picture of the author mywebwork
    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
    {{ DiscussionBoard.errors[659461].message }}
    • Profile picture of the author Johnathan
      Originally Posted by mywebwork View Post

      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
      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
      Signature
      Make money from writing, find out how now.
      {{ DiscussionBoard.errors[660104].message }}
  • Profile picture of the author kengary
    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?
    {{ DiscussionBoard.errors[660265].message }}
    • Profile picture of the author Johnathan
      Originally Posted by kengary View Post

      In this statement you gave:

      ('metaWeblog.newPost','','user','password' ,$ content,false))

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

      Would that have anything to do with it?
      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...
      Signature
      Make money from writing, find out how now.
      {{ DiscussionBoard.errors[661052].message }}
      • Profile picture of the author rapidprog
        The date needs to be in ISO8601 format. Have you tried putting the date and time in this format?

        e.g.

        20090402T11:25:00
        {{ DiscussionBoard.errors[662237].message }}
        • Profile picture of the author Johnathan
          Originally Posted by rapidprog View Post

          The date needs to be in ISO8601 format. Have you tried putting the date and time in this format?

          e.g.

          20090402T11:25:00
          Yes, I've tried doing that, but it doesn't seem to work...
          Signature
          Make money from writing, find out how now.
          {{ DiscussionBoard.errors[662368].message }}
  • Profile picture of the author Lisa Copen
    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
    {{ DiscussionBoard.errors[662986].message }}
    • Profile picture of the author Johnathan
      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?
      Signature
      Make money from writing, find out how now.
      {{ DiscussionBoard.errors[663333].message }}

Trending Topics