Make WordPress Core

Changeset 21896


Ignore:
Timestamp:
09/18/2012 07:06:27 PM (12 years ago)
Author:
nacin
Message:

Allow wp.uploadFile to upload the attachment to a post. props djzone, josephscott, maxcutler. fixes #13917.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r21857 r21896  
    48954895        }
    48964896        // Construct the attachment array
    4897         // attach to post_id 0
    48984897        $post_id = 0;
     4898        if ( ! empty( $data['post_id'] ) ) {
     4899            $post_id = (int) $data['post_id'];
     4900
     4901            if ( ! current_user_can( 'edit_post', $post_id ) )
     4902                return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
     4903        }
    48994904        $attachment = array(
    49004905            'post_title' => $name,
Note: See TracChangeset for help on using the changeset viewer.