darkelink
Forum Replies Created
-
Forum: Plugins
In reply to: [podPress] XML-RPC support?Thanks for the help, I am happy to say I have got it working. All that needs to be changed is in podPress.php:
Add to the podPress_class_init function:
add_filter('xmlrpc_methods', 'add_new_xmlrpc_methods');
and then add two new functions:
function add_new_xmlrpc_methods ($methods) { $methods ['podPress.addNewXmlrpcPost'] = 'addNewXmlrpcPost'; return $methods; } function addNewXmlrpcPost ($args) { $xmlPostID = (int) $args[0]; $xmlContent = $args[1]; podPress_add_post_meta($xmlPostID, '_podPressMedia', $xmlContent, true); }
Then data can be added by just calling RPclient.execute(“podPress.addNewXmlrpcPost”, params); on the client where params is an array: [int PostID, Hashtable xmlContent] and xmlContent has the structure that you have shown above.
Obviously this is very limited, but it does what I need it to do. I am also amusing all checks to make sure the data is correct is happening client side.
It looks like the already existing function (xmlrpc_post_addMedia in podpress_class.php) tries to achieve the same aim, but it expects a php style array as input and you can’t pass those via xml-rpc so there was no way successfully to call it.
Forum: Plugins
In reply to: [podPress] XML-RPC support?I have had a look at the source, not knowing much php myself makes it very difficult. It looks like the xmlrpc functions that already exist do not have any hooks to call them and only work for a really old version of WordPress. I have also discovered that I can call any function and pass arguments by adding some code to podpress.php:
add_filter('xmlrpc_methods', 'add_new_xmlrpc_methods'); function add_new_xmlrpc_methods( $methods ) { $methods['podPress.DoSomething'] = 'DoSomething'; return $methods; }
This will allow me to call the function DoSomething from my client. This only leaves me to figure out what function(s) I should call.
I’m guessing it would be easier to create a post using WordPress native functions, then call another function from podPress to add media to it. However I don’t completely know how this plugin works, so what function(s) would I need to call to add media to an existing post?