Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Commit

Permalink
Merge pull request #664 from WP-API/issue-661
Browse files Browse the repository at this point in the history
Pass the edit context when returning the create or update response. Fixes #661
  • Loading branch information
rachelbaker committed Nov 30, 2014
2 parents 15d891b + 79f8c42 commit 046aa32
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/class-wp-json-users-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ public function create_item( $request ) {
$user->ID = $user_id;
do_action( 'json_insert_user', $user, $request, false );

$response = $this->get_item( array( 'id' => $user_id ) );
$response = $this->get_item( array(
'id' => $user_id,
'context' => 'edit',
));
$response = json_ensure_response( $response );
$response->set_status( 201 );
$response->header( 'Location', json_url( '/wp/users/' . $user_id ) );
Expand Down Expand Up @@ -154,7 +157,10 @@ public function update_item( $request ) {

do_action( 'json_insert_user', $user, $request, false );

$response = $this->get_item( array( 'id' => $user_id ) );
$response = $this->get_item( array(
'id' => $user_id,
'context' => 'edit',
));
$response = json_ensure_response( $response );
$response->set_status( 201 );
$response->header( 'Location', json_url( '/wp/users/' . $user_id ) );
Expand Down

0 comments on commit 046aa32

Please sign in to comment.