Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   question about wordpress (https://www.warriorforum.com/programming/70859-question-about-wordpress.html)

Johnathan 1st April 2009 02:28 PM

question about wordpress
 
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?

ereadergold 1st April 2009 03:08 PM

Re: question about 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

Johnathan 1st April 2009 03:10 PM

Re: question about wordpress
 
Quote:

Originally Posted by mywebwork (Post 659107)
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 :P And the frustrating thing is, I can't seem to find any 'good' wordpress documentation (a lot of it is gobblelegook)... :P Any other ideas? :) Or perhaps ideas on where I can find out?

ereadergold 1st April 2009 05:39 PM

Re: question about wordpress
 
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

ereadergold 1st April 2009 05:43 PM

Re: question about wordpress
 
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

Johnathan 1st April 2009 10:24 PM

Re: question about wordpress
 
Quote:

Originally Posted by mywebwork (Post 659461)
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 :P
Yes, the wordpress documentation is really screwed up (I'm amazed anyone has managed to create a plugin in the first place! :P)... 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

kengary 1st April 2009 11:34 PM

Re: question about wordpress
 
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?

Johnathan 2nd April 2009 07:45 AM

Re: question about wordpress
 
Quote:

Originally Posted by kengary (Post 660265)
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 :P) 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... :P

rapidprog 2nd April 2009 02:18 PM

Re: question about wordpress
 
The date needs to be in ISO8601 format. Have you tried putting the date and time in this format?

e.g.

20090402T11:25:00

Johnathan 2nd April 2009 02:55 PM

Re: question about wordpress
 
Quote:

Originally Posted by rapidprog (Post 662237)
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... :P

Lisa Copen 2nd April 2009 07:44 PM

Re: question about wordpress
 
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

Johnathan 2nd April 2009 10:16 PM

Re: question about wordpress
 
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 :P)

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


All times are GMT -6. The time now is 09:25 AM.