Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am encountering an annoying problem with XMLRPC in wordpress. The following error is thrown: "Sorry, you are not allowed to publish posts on this site" Here is a snippet to test :

/*Credentials for XML-RPC server, plugin option*/
define('XMLRPC_USER',get_option('xmlrpc_user')) ;
define('XMLRPC_PWD',get_option('xmlrpc_pwd')) ;
define('XMLRPC_URL',get_option('xmlrpc_url')) ;

$client = new IXR_Client(XMLRPC_URL);

$content = array(
        'title' => 'title',
        'description' => 'description', //$wp_post_to_sync->post_content
        'mt_allow_comments' => 0,  // 1 to allow comments
        'mt_allow_pings' => 0,  // 1 to allow trackbacks
        'post_type' => 'post',
);

$params = array(0,XMLRPC_USER,XMLRPC_PWD,$content,true); //true : publish, false, draft

$client->query('metaWeblog.newPost',$params) ;

var_dump($client->getErrorCode()) ;
var_dump($client->getErrorMessage()) ;

var_dump ($client->getResponse()); 

The code works fine when the website is set in multisite mode but when I turn the website in single mode, it fails.

/**
define('WP_ALLOW_MULTISITE', true);
// COMMENT MULTISITE SECTION
define( 'MULTISITE', true);
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'mydomain.fr' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
*/

Does anybody can help me ?

Thanks, ben

share|improve this question
    
I found after a few hours, this error came from the role scoper plugin after turning off the multisite feature. –  ben.IT Nov 20 '12 at 9:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.