Make WordPress Core


Ignore:
Timestamp:
04/02/2015 03:48:41 PM (10 years ago)
Author:
johnbillion
Message:

Correctly set the post author in wp_xmlrpc_server::mw_editPost() when the current user is not the author of the post.

Props redsweater, markoheijnen, DrewAPicture
Fixes #24916

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/xmlrpc/mw/editPost.php

    r25002 r31983  
    9696    }
    9797
     98    /**
     99     * @ticket 24916
     100     */
     101    function test_capable_reassign_author_to_self() {
     102        $contributor_id = $this->make_user_by_role( 'contributor' );
     103        $editor_id = $this->make_user_by_role( 'editor' );
     104
     105        $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
     106        $post_id = wp_insert_post( $post );
     107
     108        $post2 = array( 'wp_author_id' => $editor_id );
     109        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
     110        $this->assertNotInstanceOf( 'IXR_Error', $result );
     111        $this->assertTrue($result);
     112
     113        $out = get_post( $post_id );
     114        $this->assertEquals( $editor_id, $out->post_author );
     115    }
     116   
    98117    function test_post_thumbnail() {
    99118        add_theme_support( 'post-thumbnails' );
Note: See TracChangeset for help on using the changeset viewer.