WP-API/WP-API — pull request #44 by rmccue (2013-12-09 04:17:53+00:00)
Title: Post Author != logged in user Check in insert_post wrong...

Hi!

In Line 790 of /lib/class-wp-json-posts.php (protected function insert_post), the userdata of a user != logged in user should be fetched and checked if it exists:

$author = get_userdata( $post['post_author'] );

As $post['post_author'] at this time is set to 0, there is always an error.
I think, this line should read

$author = get_userdata( $data['author'] );

as this is the correct User ID for the to post to be inserted.

Also, there should be a line

$post['post_author'] = $data['author'];

after the check (Line 534).

Regards,
Kuchen und Kakao