Guest User

Untitled

a guest
Jan 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. Array
  2. (
  3. [code] => rest_cannot_edit
  4. [message] => Sorry, you are not allowed to edit this user.
  5. [data] => Array
  6. (
  7. [status] => 401
  8. )
  9.  
  10. )
  11.  
  12. function update_user_api( $entry, $form ) {
  13. $user_url = 'https://myurl.com/wp-json/wp/v2/users/11?context=edit';
  14. $body = array(
  15. 'username' => '000',
  16. 'password' => '000',
  17. 'first_name' => 'test',
  18. );
  19. $response = wp_safe_remote_post( $user_url, array( 'body' => $body ) );
  20. $res = json_decode($response['body'], true);
  21. echo '<pre>';
  22. print_r($res);
  23. echo '</pre>';
  24. }
  25. add_action( 'gform_after_submission_16', 'update_user_api', 10, 2 );
Add Comment
Please, Sign In to add comment