Skip to:
Content
Pages
Categories
Search
Top
Bottom

Delete via XML-RPC

  • @lleger

    Member

    I’ve been trying to delete a post via the XML-RPC API and just haven’t had any luck. I’m communicating fine with the API, sending and receiving works as expected, and the user has correct permissions. Everything else (as far as getting posts and making new posts) is also worked as expected. However, I’m always getting a return value of ‘0’ from the API, even though the post isn’t already deleted. I’m trying to accomplish this from Buddypress using bbPress Live. Any ideas on how to do this?

    My request and response:

    <?xml version="1.0"?>
    <methodCall>
    <methodName>bb.deletePost</methodName>
    <params>
    <param><value><array><data>
    <value><string>forumadmin</string></value>
    <value><string>******</string></value>
    <value><struct>
    <member><name>post_id</name><value><int>59</int></value></member>
    </struct></value>
    </data></array></value></param>
    </params></methodCall>

    <?xml version="1.0"?>
    <methodResponse>
    <params>
    <param>
    <value>
    <int>0</int>
    </value>
    </param>
    </params>
    </methodResponse>

    Here’s the code I added to the bbPress_Live class

    function delete_post( $post_id )
    {
    global $current_user;
    if ( !$delete = $this->fetch->query( 'bb.deletePost', array( $post_id ), $current_user->user_login ) ) {
    return false;
    }

    $key = md5( 'post_' . $post_id );
    $this->cache_delete( $key );

    return true;
    }

  • You must be logged in to reply to this topic.
Skip to toolbar