akurtz
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How to scedule a Post using XMLRPC / metaWeblog.newPost ??what XML-RPC library u are using?
will the ->getIso() call work then??
Forum: Fixing WordPress
In reply to: How to scedule a Post using XMLRPC / metaWeblog.newPost ??Hi joseph scott,
did u tried by urself?
i found out not the correct format for the date_created_gmt
<member> <name>date_created_gmt</name> <value> <string>20091113T12:30:00Z</string> </value> </member>
but if i post on a unfixed blog, i got nothing as response.
var_dump() of my result just says
NULL
.in my eys this lines are responsable for that:
// Do some timestamp voodoo if ( !empty( $content_struct['date_created_gmt'] ) ) $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force elseif ( !empty( $content_struct['dateCreated']) ) $dateCreated = $content_struct['dateCreated']->getIso(); if ( !empty( $dateCreated ) ) { $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); $post_date_gmt = iso8601_to_datetime($dateCreated, GMT); } else { $post_date = $postdata['post_date']; $post_date_gmt = $postdata['post_date_gmt']; }
how can
$content_struct['dateCreated']->getIso()
work when$content_struct['dateCreated']
is of type string???this will result in a php-error. so i will get no return value… and the post will not added to the database.
wenn i remove the
->getIso()
all will work fine. the post is added to the database, but as not as future… so i have to add ancase 'future':
at this lines:switch( $content_struct["{$post_type}_status"] ) { case 'draft': case 'private': case 'publish': $post_status = $content_struct["{$post_type}_status"]; break; case 'pending': // Pending is only valid for posts, not pages. if( $post_type === 'post' ) { $post_status = $content_struct["{$post_type}_status"]; } break; default: $post_status = $publish ? 'publish' : 'draft'; break; }
then all will work fine, when my client adds
<member> <name>post_status</name> <value> <string>future</string> </value> </member>
to the struct.
After doing this i can post a scheduled post using XML-RPC.
In my oppinion this should be fixed soon in the next WP release …
or anyone can explain me how it will work, without this fixes ??
Forum: Fixing WordPress
In reply to: How to scedule a Post using XMLRPC / metaWeblog.newPost ??Damm, i figured out that’s not all to fix, the Posts will have no _gmt-Dates in database and so WP think the schedule was missed, an posts them…
So how to set the _gmt-dates at the xmlrpc.php ???
why this is not completly correctly written ????
Forum: Fixing WordPress
In reply to: How to scedule a Post using XMLRPC / metaWeblog.newPost ??I found a way to solve my problem, but i had to fix the xmlrpc.php, thats a thing i wount do, because i have to fix it at more than 250 worpressinstallations ?? .
I fixed at the Mothod: mw_newPost($args), starting at line 2007
1st fix: starting at line 2105
if( isset( $content_struct["{$post_type}_status"] ) ) { switch( $content_struct["{$post_type}_status"] ) { case 'draft': case 'private': case 'publish': case 'future': # <-- ADDED THIS LINE $post_status = $content_struct["{$post_type}_status"]; break; case 'pending': // Pending is only valid for posts, not pages. if( $post_type === 'post' ) { $post_status = $content_struct["{$post_type}_status"]; } break; default: $post_status = $publish ? 'publish' : 'draft'; break; } }
2nd fix: starting at line 2203
remove the call off non existing Method ->getIso()
// Do some timestamp voodoo if ( !empty( $content_struct['date_created_gmt'] ) ) { $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']/*->getIso()*/ ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force }elseif ( !empty( $content_struct['dateCreated']) ){ $dateCreated = $content_struct['dateCreated']/*->getIso()*/; }
In my code i add 2 fields $content-array if its in future:
if (strtotime($_REQUEST['form']['dateCreated']) > time()) { $content['post_status'] = 'future'; $publish = 0; }
so my XML will look like:
<methodCall> <methodName>metaWeblog.newPost</methodName> <params> <param> <value> <array> <data> <value>USERNAME <string></string> </value>USERNAME <value> <string>{YOUR-WP-USERNAME-HERE}</string> </value> <value> <string>{YOUR-WP-PASSWORD-HERE}</string> </value> <value> <struct> <member> <name>wp_slug</name> <value> <string></string> </value> </member> <member> <name>wp_password</name> <value>USERNAME <string></string> </value> </member> <member> <name>wp_author_id</name> <value> <string></string> </value> </member> <member> <name>title</name> USERNAME <value> <string>Test of sceduled Posting</string>USERNAME </value> </member> <member> <name>description</name> <value> <string><p>Test of sceduled Posting</p></string> </value> </member> <member> <name>mt_excerpt</name> <value> <string><p>Test of sceduled Posting</p></string> </value> </member> <member>USERNAME <name>mt_text_more</name> <value> <string></string> </value>USERNAME </member> <member> <name>mt_allow_comments</name> <value> <string></string> </value> </member> <member> <name>mt_allow_pings</name> <value> <string></string>USERNAME </value> </member>USERNAME <member> <name>date_created_gmt</name> <value> <string>2009-12-11 13:00:00</string> </value> </member> <member> <name>post_status</name> <value>USERNAME <string>future</string> </value> </member> </struct> </value> <value> <int>0</int> </value> </data> </array> </value> </param>USERNAME </params> </methodCall>
I gues there is no other way to solve this problem, until an offical fix will be released.
I hope this will help others with same problem.
greetings
Alexander Kurtz