[wp-xmlrpc] Possible to filter posts users see in their mobile app?

Muro, Matthew mmuro at advance.ua.edu
Mon Mar 21 20:46:27 UTC 2011


See source here:  http://plugins.trac.wordpress.org/browser/restrict-categories/trunk/restrict-categories.php

I'm adding it to line 50 in my __construct().

For a regular browser, it's added through the admin_init action.  For mobile app users, I'm using the xmlrpc_call action unless you think I need to use a different hook.

Matthew Muro


On Mar 21, 2011, at 3:40 PM, Eric Mann wrote:

Nothing sticks out.  Give it a try from a couple of different systems (iOS app, Android app if you have it, another XML-RPC interface).  But if it works with one, it should work with all of them.  Where are you doing the check for the XMLRPC_REQUEST constant?  My only concern would be that the check itself might be missed somehow if it lives in the wrong part of the code or is used on the wrong hook.

On Mon, Mar 21, 2011 at 1:34 PM, Muro, Matthew <mmuro at advance.ua.edu<mailto:mmuro at advance.ua.edu>> wrote:
Currently, I'm only running through the filters if is_admin() which might be why the filter isn't being applied.

I just added a check for the XMLRPC_REQUEST constant, manually filtered pre_get_posts and list_terms_exclusions and the posts/categories were properly restricted.

This is what I'm doing to handle xml-rpc:
if ( defined ( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
add_action( 'xmlrpc_call', array( &$this, 'posts' ) );
}

In my posts function is where I'm setting the categories and hooking into the filters I mentioned above.

Is there anything else I need to be checking for or will this cover it?

Matthew

Matthew,

This really depends on which XML-RPC calls the mobile application is making.
 Off the top of my head, I'd think they were using `blogger.getRecentPosts`
to get the blog's most recent posts.  This method internally calls
wp_get_recent_posts() which uses the get_posts() function to pull things
from the database.

This *should* be firing the pre_get_posts automatically.  Is it not?  Have
you tried to trace the route of a request?  What have you done so far to
extend this functionality to users of the WordPress iOS app and what have
been the results?

Matthew Muro

_______________________________________________
wp-xmlrpc mailing list
wp-xmlrpc at lists.automattic.com<mailto:wp-xmlrpc at lists.automattic.com>
http://lists.automattic.com/mailman/listinfo/wp-xmlrpc

<ATT00001..txt>



More information about the wp-xmlrpc mailing list