Skip to content

Instantly share code, notes, and snippets.

@danielbachhuber
Created December 11, 2012 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbachhuber/4255237 to your computer and use it in GitHub Desktop.
Save danielbachhuber/4255237 to your computer and use it in GitHub Desktop.
Auto-subscribe post authors to posts for XMLRPC requests
<?php
/**
* Automatically subscribe post authors to Edit Flow notifications on XML-RPC requests
*
* @see http://wordpress.org/support/topic/mobile-app-xml-rpc-auto-subscribe-not-working?replies=2
*/
function efx_auto_subscribe_post_author_xmlrpc( $post_id ) {
if ( ! function_exists( 'EditFlow' ) )
return;
EditFlow()->notifications->follow_post_user( $post_id, get_post( $post_id )->post_author, true );
}
if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST )
add_action( 'wp_insert_post', 'efx_auto_subscribe_post_author_xmlrpc' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment